```
public int longestPalindrome(String s) {
char[] letters = new char[52];
for(int i=0;i<s.length();i++){
int c = s.charAt(i)-'a';
if(c<0) c+=57;
letters[c] ^= 1;
}
int res=0;
for(int i=0;i<letters.length;i++){
if(letters[i]==1) res+=1;
}
return res<=1?s.length():s.length()-(res-1);
}
```