题目描述:

给出一个长度不超过1000的字符串,判断它是不是回文字符串(顺读,逆读均相同)的。

输入描述:

输入包括一行字符串,其长度不超过1000。

输出描述:

可能有多组测试数据,对于每组数据,如果是回文字符串则输出"Yes!”,否则输出"No!"。

输入示例:

hellolleh
helloworld

输出示例:

Yes!
No!

解题思路:

直接无脑reverse即可。

AC代码:

#include <bits/stdc++.h>
using namespace std;

int main()
{
    string str;
    while(getline(cin,str))
    {
        string temp = str; 
        reverse(temp.begin(),temp.end());
        if(str == temp)
        {
            cout << "Yes!" << endl;
        }
        else
        {
            cout << "No!" << endl;
        }
    }
    return 0;
}