最长回文子串
中心扩展即可。
public int getLongestPalindrome (String A) {
// write code here
int len=A.length();
int max=1;
for (int i=0;i<A.length()-1;i++){
max=Math.max(max,Math.max(func(A,i,i),func(A,i,i+1)));
}
return max;
}
public int func(String A,int begin,int end){
while (begin>=0&&end<A.length()&&A.charAt(begin)==A.charAt(end)){
begin--;
end++;
}
return end-begin-1;
}