```
class Solution {
public:
int longestPalindrome(string s) {
bitset<52> set;
for (char c : s) {
int i = (c > 'Z') ? (c - 'a' + 26) : (c - 'A');
set.flip(i);
}
int odd = set.count();
return s.size() - (odd == 0 ? 0 : odd - 1);
}
};
```