killjee has got a string s and he asks you to find a palindromic sub-sequence of that string for him. If there exist multiple such string he wants the one which is laxicographically smallest.
INPUT FORMAT
Only line of input contains a string s.
OUTPUT FORMAT
Print a palindromic string which is sub-sequence of string s. If multiple answers exist output the one which is lexicographically smallest.
Print 1 if no such subsequence is present in the string.
INPUT CONSTRAINTS
\(1 \le |s| \le 10^6\)
Only subsequence of the given string is string itself which is palindromic.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor