Longest palindrome length

Write codeEasy11 min

Your task

Given a string of letters (case-sensitive), you may rearrange any subset of them to form a palindrome. Return the length of the longest palindrome you can build. Example: 'abccccdd' gives 7, e.g. 'dccaccd'. A single leftover letter may sit in the middle, but at most one.

Examples

longest_palindrome_length(letters: str) -> int
Example 1
Inputlongest_palindrome_length("abccccdd")
Output7