[C++] solution
\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        unordered_map<int,int> mp;\n        int res = 0;\n        for(int i = 0; i < s.lengt
```\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        unordered_map<int,int> mp;\n        int res = 0;\n        for(int i = 0; i < s.length(); i++) {\n            mp[s[i]]++;\n            if(mp[s[i]]%2==0) {\n                res += mp[s[i]];\n                mp[s[i]] = 0;\n            }\n        }\n        for(auto x: mp) {\n            if(x.second==1) {\n              res++;\n              break;\n            }  \n        }\n        return res;\n    }\n};\n```
['C', 'C++']