#C8811. Longest Palindrome Length

    ID: 52835 Type: Default 1000ms 256MiB

Longest Palindrome Length

Longest Palindrome Length

You are given a string s consisting of lowercase or uppercase letters. Your task is to determine the length of the longest palindrome that can be constructed from the letters of s by rearranging them. A palindrome is a string that reads the same forwards and backwards.

The construction follows these rules: for each character with frequency f, you can use f characters if f is even, or f-1 characters if f is odd. If there is at least one character with an odd frequency, you can place exactly one odd character in the middle. This can be mathematically represented as:

$$ \text{result} = \sum_{c \in s} \left( f(c) - (f(c) \bmod 2) \right) + \begin{cases} 1 & \text{if any } f(c) \bmod 2 = 1, \\ 0 & \text{otherwise.} \end{cases} $$

Compute and output the maximum length of such a palindrome.

inputFormat

The input consists of a single line containing the string s. The string is read from standard input.

outputFormat

Output a single integer representing the length of the longest palindrome that can be constructed from s. The output should be written to standard output.

## sample
abccccdd
7