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 | #include<stdio.h> #include<string.h> int main() { int l,l1,l2,i,j,bin; char s[1000],s1[1000],s2[1000]; while(gets(s)) { bin=0; l1=-1; l=strlen(s); if(l==4 && s[0]=='D' && s[1]=='O' && s[2]=='N' && s[3]=='E') break; for(i=0;i<l;i++) { if(s[i]!='.' && s[i]!=',' && s[i]!='?' && s[i]!='!' && s[i]!=' ') { l1++; s1[l1]=s[i]; } } for(j=0;j<=l1;j++) { if(s1[j]!=s1[l1-j] && s1[j]!=(s1[l1-j]+32) && s1[j]!=(s1[l1-j]-32)) { printf("Uh oh..\n"); bin=1; break; } } if(bin==0) printf("You won't be eaten!\n"); } } |
Thursday, March 3, 2016
UVA 10945
Labels:
UVA Solution
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)