class Solution {
public:
bool validPalindrome(string s) {
int len = s.size();
if(len<=2){
return true;
}
return judge(s, 0, len-1, 1);
}
private:
bool judge(string s, int left, int right, int diff){
while(left < right){
if(s[left] != s[right]){
if(diff == 0 ){
return false;
}
return judge(s, left+1, right, diff-1) || judge(s, left, right-1, diff-1);
}
left++;
right--;
}
return true;
}
};