题解 | #回文字符串#
回文字符串
https://www.nowcoder.com/practice/df00c27320b24278b9c25f6bb1e2f3b8
#include <iostream> #include <string> #include <cstring> using namespace std; int main() { string a; int lena = 0; while (cin >> a) { lena = a.length(); int i = 0; while (i <= lena) { if (a[i] != a[lena-1-i]) { cout << "No!" << endl; return 0; } i++; } cout << "Yes!" << endl; } }