class Solution {
public:
bool isPalindrome(string s) {
if(s.empty() == true)
return true;
string result="";
for(auto x:s){
if(isalnum(x)){
if(isupper(x))
result.push_back(tolower(x));
else
result.push_back(x);
}
}
string temp = result;
reverse(temp.begin(), temp.end());
cout << result << endl;
cout << temp << endl;
if(result == temp){
return true;
}
else{
return false;
}
}
};
有关字符的一些判断数字、字母大小写的操作要熟悉