题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2163
#include<iostream>
#include<cstring>
using namespace std;
int judge(char *s)
{
int i,len=strlen(s),flag=1,j;
for(i=0,j=len-1;i<=j;i++,j--)
{
if(s[i]!=s[j]) flag=0;
if(flag==0) break;
}
return flag;
}
int main()
{
char s[55];
int Case=1;
while(cin>>s)
{
int len=strlen(s);
if(len==4&&s[0]=='S'&&s[1]=='T'&&s[2]=='O'&&s[3]=='P') break;
if(judge(s))
cout<<"#"<<Case++<<": "<<"YES"<<endl;
else
cout<<"#"<<Case++<<": "<<"NO"<<endl;
}
return 0;
}