Maximum palindrome#5062

Maximum palindrome

1 second
128 megabytes
Very easy (≈850)

Remove the minimum number of characters from the given string so that it becomes a palindrome (a string that reads the same both forwards and backwards).

Input

One non-empty string of up to characters. The string consists only of uppercase Latin letters.

Output

Print the longest possible palindrome that can be obtained from the original string by deleting some characters. If there are multiple such palindromes, print any one of them.

Examples

Example 1

Loading
Loading