0 ms, faster than 100.00% of C++ online submissions
\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        int len=1;\n        unordered_map<char,int>mp;\n        for(auto c:s){\n            
```\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        int len=1;\n        unordered_map<char,int>mp;\n        for(auto c:s){\n            mp[c]++;\n        }\n        for(auto x:mp){\n            if(x.second>=2){\n                if(x.second%2==0)len+=x.second;\n                else len+=x.second-1;\n            }\n        }\n        if(len>s.size())return len-1;\n        return len;\n    }\n};\n```
['C']