题目链接:https://leetcode-cn.com/problems/valid-palindrome/
题目如下:
class Solution {
public:
bool isPalindrome(string s) {
string str;
for(auto ch:s){
if(isalnum(ch)){
str+=tolower(ch);
}
}
int l=0,r=str.size()-1;
while(l<r){
if(str[l]!=str[r]) return false;
l++;
r--;
}
return true;
}
};