Simple fast Java solution
\n    public int longestPalindrome(String s) {\n        int [] chars = new int[128];\n        int len = s.length();\n    \tfor(char ch : s.toCharArray()) {\n   
```\n    public int longestPalindrome(String s) {\n        int [] chars = new int[128];\n        int len = s.length();\n    \tfor(char ch : s.toCharArray()) {\n    \t\tchars[ch - \'A\'] ^= ch;\n    \t\tlen = len + (chars[ch - \'A\'] == 0 ? 1 : -1);\n    \t}\n    \treturn len == s.length() ? len : len + 1;\n    }\n```
['Java']