#K79042. Lexicographically Largest Substring

    ID: 35220 Type: Default 1000ms 256MiB

Lexicographically Largest Substring

Lexicographically Largest Substring

Given a string \(s\) consisting only of lowercase alphabets, your task is to find the lexicographically largest substring. In other words, among all substrings \(s[i:]\) (for \(0 \le i < n\)), you need to output the one that is greatest in lexicographical order.

Formally, if \(s = s_0s_1...s_{n-1}\), you must compute: \[ \max_{0 \le i < n} s[i:] \]

If the string is empty, output an empty string.

inputFormat

The input consists of a single string \(s\) read from standard input. The string is composed of lowercase English letters.

outputFormat

Output the lexicographically largest substring of the given string \(s\) to standard output.

## sample
ababaa
babaa