利用指针判断字符串是否为回文。(正读和反读都一样的字符串)
输入格式: 输入字符串
输出格式: 输出YES或者NO
输入:
wenew
输出:
YES
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;string x,y;int main()
{cin>>x;y = x;reverse(y.begin(),y.end());if(x == y)cout<<"YES"<<endl;elsecout<<"NO"<<endl;return 0;
}