409. Longest Palindrome
https://leetcode.com/problems/longest-palindrome/
Python
from collections import Counter
class Solution:
def longestPalindrome(self, s: str) -> int:
counts = Counter(s)
ans = 0
odd_presented = 0
for char, count in counts.items():
print(char, count)
if count % 2 == 0:
ans += count
else:
ans += (count-1)
odd_presented += 1
if odd_presented > 0:
ans += 1
return ans