ASubsequence is a sequence obtained by deleting zero or more characters in astring. A Palindrome is a string which when read from left to right, reads sameas when read from right to left. Given a string, find the longest palindromicsubsequence. If there are many answers to it, print the one that comes lexicographicallyearliest.
Constraints
• Maximum length of string is 1000.
• Each string has characters `a' to `z' only.
Input
Inputconsists of several strings, each in a separate line. Input is terminated byEOF.
Output
For eachline in the input, print the output in a single line.
Sample Input