killjee and smallest palindrom
Practice
0 (0 votes)
Very Easy
Problem
43% Success 483 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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\)

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
11 votes
Tags:
Basic ProgrammingEasyOpenApprovedHash table
Points:30
Tags:
MediumAlgorithmsMathematicsOpenApprovedGame Theory
Points:30
7 votes
Tags:
AlgorithmsApprovedDynamic ProgrammingGreedy AlgorithmsMediumOpenSortingTwo dimensional