📜  c++ 检查回文 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:57.648000             🧑  作者: Mango

代码示例2
#include
#include
using namespace std;
int main() {
    string s; cin >> s;
    int a = 0;
    for(int i = 0; i < (s.length() / 2); i++) 
        if(s[i] == s[s.length() - 1 - i]) a++;
    if(a == (s.length() / 2)) cout << "YES";
    else cout << "NO";
    return 0;
}