311. The Longest Palindrome You Can Build
Given a string of letters, you may rearrange them and discard any you do not want. Print the length of the longest palindrome you can build.
Upper and lower case are DIFFERENT letters, so A and a cannot pair with each
other.
You never have to build the palindrome, only measure it. A palindrome reads the same forwards and backwards, so every letter except possibly one sits in a mirrored pair:
for each letter, take count / 2 pairs, contributing 2 each
if any letter had an odd count, one spare letter goes in the middle
So the answer is the sum of count / 2 * 2 over all letters, plus 1 if any count
was odd. Note that at most ONE spare can be used however many letters have an odd
count, because a palindrome has only one middle position.
Constraints - `1 ≤ length ≤ 200000` - Every character is `a` to `z` or `A` to `Z`.
Input
One line: the string, made of upper and lower case English letters.
Output
Print one integer: the length of the longest palindrome that can be built from those letters.
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.