class Solution {
public:
bool isPalindrome(string s) {
string copy_s = "";
for(int m = 0;m < s.size();m++)
{
if(s[m] < 123 && s[m] > 96)
copy_s += (s[m] - 32);
if(s[m] < 91 && s[m] > 64 || s[m] > 47 && s[m] < 58)
copy_s += s[m];
}
s = copy_s;
reverse(copy_s.begin(), copy_s.end());
if(s.empty() || copy_s == s)
return true;
else return false;
}
};
Valid Palindrome
最新推荐文章于 2024-01-04 12:53:14 发布