forked from rabiulcste/uvaoj-solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uva 10945.cpp
37 lines (35 loc) · 819 Bytes
/
uva 10945.cpp
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
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int len, i, j;
char b[10000];
while(gets(b) && strcmp("DONE", b)!=0){
char a[10000];
char c[10000];
j=0;
len=strlen(b);
for(i=0; i<len; i++){
if(b[i]>=65 && b[i]<=90){
a[j]=b[i]+32;
j++;
}
else if(b[i]>=97 && b[i]<=122){
a[j]=b[i];
j++;
}
}
a[j]='\0';
strcpy(c, a);
reverse(c, c+j);
if(strcmp(a, c)==0)
printf("You won't be eaten!\n");
else
printf("Uh oh..\n");
}
return 0;
}