#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<string>
#include<cctype>
#include<stdlib.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
char s[100], temp[100], t[100];
char c;
int j=0,cnt=0;
int i;
while(gets(t)){
if(strcmp(t,"DONE")==0)
break;
else{
while(1){
if(t[j]=='\0')
break;
else{
if(isalpha(t[j])>0){
s[cnt]=t[j];
cnt++;
}
}
j++;
}
s[cnt]='\0';
cnt=0;
j=0;
memset(t,'\0',strlen(t));
strcpy(temp,s);
reverse(s,s+strlen(s));
for(i=0; i<strlen(s); i++){
s[i]=toupper(s[i]);
temp[i]=toupper(temp[i]);
}
if(strcmp(s,temp)==0)
puts("You won't be eaten!");
else
puts("Uh oh..");
}
}
return 0;
}
#include<string>
#include<cstring>
#include<cstdio>
#include<string>
#include<cctype>
#include<stdlib.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
char s[100], temp[100], t[100];
char c;
int j=0,cnt=0;
int i;
while(gets(t)){
if(strcmp(t,"DONE")==0)
break;
else{
while(1){
if(t[j]=='\0')
break;
else{
if(isalpha(t[j])>0){
s[cnt]=t[j];
cnt++;
}
}
j++;
}
s[cnt]='\0';
cnt=0;
j=0;
memset(t,'\0',strlen(t));
strcpy(temp,s);
reverse(s,s+strlen(s));
for(i=0; i<strlen(s); i++){
s[i]=toupper(s[i]);
temp[i]=toupper(temp[i]);
}
if(strcmp(s,temp)==0)
puts("You won't be eaten!");
else
puts("Uh oh..");
}
}
return 0;
}
No comments:
Post a Comment