代码:
#include<cstdio> #include<cstring> using namespace std; int main() { char a[101],s[101]; int top,next,mid,n; gets(a);n=strlen(a); mid=n/2-1;top=0; for(int i=0;i<=mid;i++) s[++top]=a[i]; if(n%2==0)next=mid+1; else next=mid+2; for(int i=next;i<=n-1;i++) { if(a[i]!=s[top])break; top--; } if(top==0)printf("YES"); else printf("NO"); }