Problem Type : String
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,n,len,one ,two;
char ch[20];
scanf("%d",&n);
getchar();
for(i=1; i<=n; i++)
{
gets(ch);
len=strlen(ch);
if(len==3)
{
one=0;
two=0;
for(j=0; j<len; j++)
{
if(ch[j]=='O'|| ch[j]=='o')
one++,two++;
else if(ch[j]=='n'|| ch[j]=='N')
one++;
else if(ch[j]=='E'|| ch[j]=='e')
one++;
else if(ch[j]=='t'|| ch[j]=='T')
two++;
else if(ch[j]=='w'|| ch[j]=='W')
two++;
}
if(one>two)
{
printf("1\n");
}
else
{
printf("2\n");
}
}
else if(len==5)
{
printf("3\n");
}
}
return 0;
}
No comments:
Post a Comment