Description
Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.
Examples
Input:
s = "abccccdd"Output:
7Explanation:
dccaccd uses 7 chars.
Input:
s = "aabbcc"Output:
6Explanation:
All characters appear in pairs, so all 6 characters can form a palindrome like "abccba".
Input:
s = "racecar"Output:
7Explanation:
Character pairs: r(2), a(2), c(2), and one single e. All pairs plus one odd character in the center form a palindrome: "racecar" uses all 7 characters.
Constraints
- •
1 ≤ s.length ≤ 2000