Longest Palindrome Problem

Longest Palindrome Problem — ExecCode Easy DSA Practice

Solve the Longest Palindrome problem on ExecCode. Free online easy DSA practice in Hashing. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are 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. Your task is to letters are case sensitive, for example, "Aa" is not considered a palindrome. Return the required answer exactly as shown in the examples.

Examples

Input {"s": "abccccdd"}; Output 7. Input {"s": "a"}; Output 1

Constraints

1 <= s.length <= 2000 s consists of lowercase and/or uppercase English letters only.

Practice Longest Palindrome free on ExecCode. Browse DSA problems, topic map, and placement guides.