Mike and LMS
80% Success3605 Attempts20 Points1s Time Limit256MB Memory1024 KB Max Code

Disappointed and Disheartened Mike is really tired of jail life, and needs to take his mind off all this. Mike's roomate and good friend Kevin decidedes to help him, and tells him to try the following task:

Given a string S consisting of lowercase English alphabets of size N, can you find the lexicographically maximum substring of this string ? Mike has no knowledge what so ever of strings, and needs your help. Can you help Mike and improve his mood?

Input Format :

The first line contains a single integer N denoting the length of string S. The next line contains the string S.

Output Format :

Print the lexicographically maximum substring of String S on a single line.

Constraints :

\( 1 \le N \le 5000 \)

Examples
Input
6
ababaa
Output
babaa
Explanation

Lexicographically maximum string of the given string is \(babaa\) .

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 Editor...
Results