Moya is a baby Alien who accidentally reached earth. He is stuck in his spaceship which will
Fantastic news! We've Found the answer you've been seeking!
Question:
Moya is a baby Alien who accidentally reached earth. He is stuck in his spaceship which will get activated by a unique passcode.
The spaceship shows a string S. If Moya correctly tells the palindromic sub sequence of that string, then spaceship will get activated and Maya wil reach home. If there exist matt wants the one which is lexicographically smallest.
Moya is unable to decode the passcode. You being a smart programmer will decode the passcode for Moya
Input Format
The only line of input contains a string s.
Output Format
Print a palindromic passcode which is sub−sequence of string s. If multiple passcodes exist then output the one which is lexicographically smallest.
Print −1 if no such passcode is possible.
write code in java
Related Book For
Posted Date: