#C11804. Longest Palindrome Construction

    ID: 41161 Type: Default 1000ms 256MiB

Longest Palindrome Construction

Longest Palindrome Construction

You are given a string s consisting of lowercase or uppercase letters. Your task is to find the length of the longest palindrome that can be built with those letters.

A palindrome is a word or sequence that reads the same backward as forward. For example, the string "abccccdd" can be rearranged into "dccaccd", which is a palindrome of length 7.

Note: The letters are case-sensitive.

Hint: For each character, you can use all even counts, and if there is any odd count, you can put one additional character in the center to form the palindrome.

inputFormat

The input consists of a single line containing a string s.

Constraints:

  • s consists of English letters (both uppercase and lowercase).
  • The length of s is between 0 and 105.

outputFormat

Output a single integer, the length of the longest palindrome that can be formed with the letters from the given string.

## sample
abccccdd
7