#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
string sing[25],plural[25];
int main()
{
string w,s,sd,ss;
register int i,k,l,n,L;
//freopen("in.txt","r",stdin);
scanf("%d%d",&L,&n);
for(i=0;i<L;i++)
cin>>sing[i]>>plural[i];
while(n--)
{
cin>>w;
for(i=0;i<L;i++)
if(w==sing[i])
break;
if(i<L)
{
cout<<plural[i]<<endl;
continue;
}
l=w.length()-1;
k=l-1;
if(w[l]=='y' && w[k]!='a' && w[k]!='e' && w[k]!='i' && w[k]!='o' && w[k]!='u')
{
for(i=0;i<l;i++)
cout<<w[i];
cout<<"ies\n";
}
else if((w[l]=='o'||w[l]=='s'||w[l]=='x')||(w[l]=='h'&&(w[k]=='c'||w[k]=='s')))
cout<<w<<"es\n";
else
cout<<w<<"s\n";
}
return 0;
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.