Palindromic Subsequence#2179

Palindromic Subsequence

1 second
122.174 megabytes
Medium

A subsequence is a sequence obtained by deleting zero or more characters from a string. A palindrome is a string that reads the same from left to right and from right to left. Given a string, find the longest palindromic subsequence. If there are several possible answers, choose the lexicographically smallest one.

Input

The input consists of several tests, each given on a separate line. The maximum length of a line is . Each line contains only characters from 'a' to 'z'.

Output

For each line, output the lexicographically smallest longest palindromic subsequence on a separate line.

Examples

Example 1

Loading
Loading