JAVA 100% Faster Solution
\nclass Solution {\n    public int longestPalindrome(String s) {\n        int[] freq = new int[256];\n        for (char c : s.toCharArray()) freq[c]++;\n\n     
```\nclass Solution {\n    public int longestPalindrome(String s) {\n        int[] freq = new int[256];\n        for (char c : s.toCharArray()) freq[c]++;\n\n        int even = 0, odd = 0;\n        for (int i = 0; i < 256; i++) {\n            if (freq[i] % 2 == 0) even += freq[i];\n            else {\n                even += (freq[i] - 1);\n                odd++;\n            }\n\n        }\n\n        return odd == 0 ? even : even + 1;\n    }\n}\n```
['Java']