#include
using namespace std;const int maxn=1000;
bool palindrome(char *str)
{
int i;
int len=strlen(str);
stackS; //前一半入栈
for(i=0; iS.push(str[i]);
//奇数跳过中心点
if(len%2==1)
i++;
//判断比较
while(!S.empty())
{
if(str[i]!=S.top())
return false;
else
{
i++;
S.pop();
}
}
return true;
}
int main()
{
char str[maxn];
while(cin>>str)
{
if(palindrome(str))
cout<<"yes palindrome"<else
cout<<"no palindrome"<}
return 0;
}


![回文【栈] 回文【栈]](http://www.mshxw.com/aiimages/31/938044.png)
