UVa 11233 - Deli Deli

#include<stdio.h>
#include<string.h>
struct data
{
    char s1[50];
    char s2[50];
};
int main()
{
    struct data s[25];
    char str[50];
    int l,n,i,j,k,flag,l1;
    while(scanf("%d %d",&l,&n)==2)
    {
        for(i=0; i<l; i++)
            scanf("%s %s",&s[i].s1,&s[i].s2);
        for(i=0; i<n; i++)
        {
            flag=0;
            scanf("%s",str);
            for(j=0; j<l; j++)
            {
                if(strcmp(str,s[j].s1)==0)
                {
                    printf("%s\n",s[j].s2);
                    flag=1;
                    break;
                }
            }
            if(flag==1)
                continue;
            l1=strlen(str);
            if((str[l1-2]!='a'&&str[l1-2]!='e'&&str[l1-2]!='i'&&str[l1-2]!='o'&&str[l1-2]!='u') && str[l1-1]=='y')
            {
                str[l1-1]='i';
                str[l1]='e';
                str[l1+1]='s';
                str[l1+2]='\0';
                printf("%s\n",str);
            }
            else if(str[l1-1]=='o'||str[l1-1]=='s'||str[l1-1]=='x'||(str[l1-1]=='h'&&str[l1-2]=='c') || (str[l1-1]=='h'&&str[l1-2]=='s'))
            {
                str[l1]='e';
                str[l1+1]='s';
                str[l1+2]='\0';
                printf("%s\n",str);
            }
            else
            {
                str[l1]='s';
                str[l1+1]='\0';
                printf("%s\n",str);
            }
        }
    }
    return  0;
}
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 মন্তব্য(গুলি):

একটি মন্তব্য পোস্ট করুন