最长回文子串
class Solution {
public:
string longestPalindrome(string s) {
if(s.size()==0 || s.size()==1) return s;
int n=s.size();
vector<vector<bool>> isPail(n,vector<bool>(n,false));
isPail[0][0]=true;
int left=0,right=0;
for(int j=1;j<n;j++){
for(int i=0;i<j;i++){
if(s[i]==s[j] && (isPail[i+1][j-1] || (j-1-(i+1)+1)<2)){
isPail[i][j]=true;
if(j-i>right-left){
left=i;right=j;
}
}
}
}
return s.substr(left,right-left+1);
}
};