| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:附代码纪念游过80,硬上呗In Reply To:附代码纪念游过80,硬上呗 Posted by:realkingiscoming at 2009-11-08 22:15:26 #include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
//freopen("in.txt","r",stdin);
int l,n;
string s,t;
map<string,string>m;
cin>>l>>n;
while(l--)
{
cin>>s>>t;
m[s]=t;
}
while(n--)
{
cin>>s;
int len=s.length();
if(m.find(s)!=m.end()) cout<<m[s]<<endl;
else if(s[len-1]=='y'&&len>1&&(s[len-2]!='a'&&s[len-2]!='e'&&s[len-2]!='i'&&s[len-2]!='o'&&s[len-2]!='u'))
{
s[len-1]='i';
cout<<s<<"es"<<endl;
}
else if(s[len-1]=='o'||s[len-1]=='s'||s[len-1]=='x'||(s[len-1]=='h'&&(s[len-2]=='s'||s[len-2]=='c')))
{
cout<<s<<"es"<<endl;
}
else cout<<s<<'s'<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator