https://leetcode.com/problems/longest-palindrome/description/
class Solution {
public:
int longestPalindrome(string s) {
int res = 0;
bool mid = false;
map<char, int> Mp;
for(int i=0; i<s.size(); i++) Mp[s[i]] +=1;
for(auto it=Mp.begin(); it!=Mp.end(); it++){
res += it->second;
if(it->second % 2 ==1){
res -= 1;
mid = true;
}
}
return mid? res+1: res;
}
};