Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:附代码纪念游过80,硬上呗

Posted by 731371663 at 2011-01-21 20:02:29 on Problem 3366
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator