C++
\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        unordered_map<char,int>freq;\n        int res = 0;\n        int oddCount = 0;\n     
```\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        unordered_map<char,int>freq;\n        int res = 0;\n        int oddCount = 0;\n        for(int i = 0; i < s.length(); ++i){\n            freq[s[i]]++;\n        }\n        /*\n            two cases:\n                if current counter is even, take all\n                if current counter is odd, take even part, and set one as the mid part.\n        */\n        for(auto i : freq){\n            if(i.second % 2 == 0){\n                res += i.second;\n            }else{\n                res += i.second -1;\n                oddCount = 1;\n            }\n        }\n        \n        return res + oddCount;\n    }\n};\n```
['C']