Monday, November 7, 2016

UVA 10945.Cpp

#include<bits/stdc++.h>
using namespace std;
int main()
{
string a,b,c;
int i,op;
while(getline(cin,a)){
if(a=="DONE")break;
b=""; op =   a.size();  
 for(i=0; i < op ;i++)
if (a[i] >= 'A' && a[i] <= 'Z' || a[i] >= 'a' && a[i] <= 'z')
b.push_back(toupper(a[i]));
string r(b.rbegin(),b.rend());
if(b==r)cout << "You won't be eaten!" << endl;
else cout << "Uh oh.." << endl;
}
return 0;
}

No comments: