#include<stdio.h>
#include<string.h>
int main()
{
char str[10000],ary[10000];
int len,i,j,k,l,f;
// freopen("F:\\a.txt","r",stdin);
while(gets(str)!=NULL)
{
len=strlen(str);
if((len==4)&&(str[0]=='D')&&(str[1]=='O')&&(str[2]=='N')&&(str[3]=='E'))
break;
k=0;
for(i=0;i<len;i++)
{
if((str[i]>='a')&&(str[i]<='z'))
ary[k++]=str[i];
else if((str[i]>='A')&&(str[i]<='Z'))
ary[k++]=str[i]+32;
}
ary[k]='\0';
f=0;
for(j=0,l=k-1;(j<len&&l>=0);j++,l--)
{
if(ary[j]!=ary[l])
{
f=1;
break;
}
}
if(f==1)
printf("Uh oh..\n");
else
printf("You won't be eaten!\n");
}
return 0;
}
#include<string.h>
int main()
{
char str[10000],ary[10000];
int len,i,j,k,l,f;
// freopen("F:\\a.txt","r",stdin);
while(gets(str)!=NULL)
{
len=strlen(str);
if((len==4)&&(str[0]=='D')&&(str[1]=='O')&&(str[2]=='N')&&(str[3]=='E'))
break;
k=0;
for(i=0;i<len;i++)
{
if((str[i]>='a')&&(str[i]<='z'))
ary[k++]=str[i];
else if((str[i]>='A')&&(str[i]<='Z'))
ary[k++]=str[i]+32;
}
ary[k]='\0';
f=0;
for(j=0,l=k-1;(j<len&&l>=0);j++,l--)
{
if(ary[j]!=ary[l])
{
f=1;
break;
}
}
if(f==1)
printf("Uh oh..\n");
else
printf("You won't be eaten!\n");
}
return 0;
}
No comments:
Post a Comment