原题链接:Leetcode 125. 验证回文串
class Solution {
public:
bool isPalindrome(string s) {
string news;
for (auto x : s) {
if (isupper(x)) {
news += tolower(x);
} else if (islower(x)) {
news += x;
} else if (isdigit(x)) {
news += x;
}
}
string tmp;
for (int i = news.length() - 1; i >= 0; i--) {
tmp += news[i];
}
if (news == tmp)
return true;
return false;
}
};