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