JAVA Solution. Simple and Clear, Using int[26]
\n    public int longestPalindrome(String s) {\n        int[] lowercase = new int[26];\n        int[] uppercase = new int[26];\n        int res = 0;\n        fo
\n    public int longestPalindrome(String s) {\n        int[] lowercase = new int[26];\n        int[] uppercase = new int[26];\n        int res = 0;\n        for (int i = 0; i < s.length(); i++){\n            char temp = s.charAt(i);\n            if (temp >= 97) lowercase[temp-'a']++;\n            else uppercase[temp-'A']++;\n        }\n        for (int i = 0; i < 26; i++){\n            res+=(lowercase[i]/2)*2;\n            res+=(uppercase[i]/2)*2;\n        }\n        return res == s.length() ? res : res+1;\n            \n    }
[]