-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUVA 11233.cpp
61 lines (61 loc) · 1.31 KB
/
UVA 11233.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<stdio.h>
#include<string.h>
int main()
{
int l,n,i,j,m;
char c[105][30],s[30];
scanf("%d%d",&m,&n);
getchar();
for(i=0; i<m*2; i++)
{
scanf("%s",c[i]);
}
getchar();
for(i=0; i<n; i++)
{
int flag=0,ies=0,y=0;
memset(s,'\0',sizeof(s));
gets(s);
l=strlen(s);
if(m!=0)
{
for(j=0; j<m*2; j+=2)
{
if(strcmp(s,c[j])==0)
{
printf("%s\n",c[j+1]);
flag=1;
break;
}
}
}
if(flag==1)
continue;
if(s[l-1]=='y')
{
y=1;
if(s[l-2]!='a'&&s[l-2]!='e'&&s[l-2]!='i'&&s[l-2]!='o'&&s[l-2]!='u')
{
s[l-1]='i';
s[l]='e';
s[l+1]='s';
ies=1;
}
}
else if((s[l-1]=='o')||(s[l-1]=='s')||(s[l-1]=='x')||(s[l-1]=='h' && s[l-2]=='c')||(s[l-1]=='h'&&s[l-2]=='s'))
{
s[l]='e';
s[l+1]='s';
}
else
{
s[l]='s';
}
if(y==1&&ies==0)
{
s[l]='s';
}
puts(s);
}
return 0;
}