This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.
You are given string $*s*$ consisting of lowercase English letters only. Find its lexicographically largest palindromic subsequence.
We'll call a non-empty string $*s*[*p*_{1}, where $$*p*_{2}... *p*_{*k*}]$ = $*s*_{*p*_{1}}*s*_{*p*_{2}}... *s*_{*p*_{*k*}}$ ($1$ $≤$ $*p*_{1} < *p*_{2} < ... < *p*_{*k*}$ $≤$ $|*s*|$) a subsequence of string $*s*$ = $*s*_{1}$$*s*_{2}... *s*_{|*s*|}$$|*s*|$ is the length of string $*s*$. For example, strings "abcb", "b" and "abacaba" are subsequences of string "abacaba".
String $*x*$ = $*x*_{1} if either $$*x*_{2}... *x*_{|*x*|}$ is lexicographically larger than string $*y*$ = $*y*_{1}$$*y*_{2}... *y*_{|*y*|}$$|*x*|$ > $|*y*|$ and $*x*_{1} = *y*_{1}$, $*x*_{2} = *y*_{2}$, ..., $*x*_{|*y*|} = *y*_{|*y*|}$, or there exists such number $*r*$ ($*r* < |*x*|$, $*r* < |*y*|$) that $*x*_{1} = *y*_{1}$, $*x*_{2} = *y*_{2}$, ..., $*x*_{*r*} = *y*_{*r*}$ and $*x*_{*r* + 1} > *y*_{*r* + 1}$. Characters in the strings are compared according to their ASCII codes. For example, string "ranger" is lexicographically larger than string "racecar" and string "poster" is lexicographically larger than string "post".
String $*s*$ = $*s*_{1}. In other words, a string is a palindrome if it reads the same way from left to right and from right to left. For example, palindromic strings are "$$*s*_{2}... *s*_{|*s*|}$ is a palindrome if it matches string $*rev*(*s*)$ = $*s*_{|*s*|}$$*s*_{|*s*| - 1}... *s*_{1}$racecar", "refer" and "z".
Input
The only input line contains a non-empty string $*s*$ consisting of lowercase English letters only. Its length does not exceed $10$.
Output
Print the lexicographically largest palindromic subsequence of string $*s*$.
Note
Among all distinct subsequences of string "radar" the following ones are palindromes: "a", "d", "r", "aa", "rr", "ada", "rar", "rdr", "raar" and "radar". The lexicographically largest of them is "rr".
样例
radar
rr
bowwowwow
wwwww
codeforces
s
mississipp
ssss
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。