Simple HashSet solution Java
\npublic int longestPalindrome(String s) {\n        if(s==null || s.length()==0) return 0;\n        HashSet<Character> hs = new HashSet<Character>();\n        i
```\npublic int longestPalindrome(String s) {\n        if(s==null || s.length()==0) return 0;\n        HashSet<Character> hs = new HashSet<Character>();\n        int count = 0;\n        for(int i=0; i<s.length(); i++){\n            if(hs.contains(s.charAt(i))){\n                hs.remove(s.charAt(i));\n                count++;\n            }else{\n                hs.add(s.charAt(i));\n            }\n        }\n        if(!hs.isEmpty()) return count*2+1;\n        return count*2;\n}\n```
[]