Palindrome
Time: 1 s
Memory: 125 MB
Memory: 125 MB
You are given a string s consisting of uppercase and lowercase English letters.
Your task is to determine the maximum possible length of a palindrome that can be formed using the letters of the string.
Note that letters are case-sensitive — for example, 'A' and 'a' are different characters.
Your task is to determine the maximum possible length of a palindrome that can be formed using the letters of the string.
Note that letters are case-sensitive — for example, 'A' and 'a' are different characters.
Input
The first line contains a string s.The string consists of English letters ('a'–'z', 'A'–'Z') only.
Constraint
\(1<=|s|<=10^5\)
Output
Print a single integer — the length of the longest palindrome that can be built using the letters of s.
Examples
| Input | Output |
|---|---|
|
abccccdd
|
7
|
| Input | Output |
|---|---|
|
Aa
|
1
|
Notes
A palindrome reads the same backward as forward.You can rearrange the letters of the given string to form the palindrome.
Problem Info
| Problem ID | 708 |
| Time Limit | 1000 ms |
| Memory Limit | 128000 KB |
| Moderators | shoriful41 , nayeem17 |
Statistics
Submit
You need to Login or Registration for submit your solution