题解 | #回文字符串#
回文字符串
https://www.nowcoder.com/practice/df00c27320b24278b9c25f6bb1e2f3b8
#include<iostream> using namespace std; int main() { string s; while (cin >> s) { int len = s.size(); bool flag = false; for (int i = 0; i < len / 2; i++) { if (s[i] != s[len - i - 1]) { flag = true; cout << "No!" << endl; break; } } if (flag) { continue; } cout << "Yes!" << endl; } return 0; }