Isomorphisms – 2#5938

Isomorphisms – 2

1 second
256 megabytes
Very hard

Two strings and are considered isomorphic if you can rename all the letters in the first string to transform it into the second one. Importantly, different letters must be renamed to different letters, and identical letters must remain identical.

For instance, the strings "" and "" are isomorphic. The renaming would be: change the letter '' to '', and '' to ''. However, the strings "" and "" are not isomorphic.

You are given a string . Define a function (where is a non-empty string) as the number of substrings of that are isomorphic to , multiplied by the length of . Your task is to find a string , composed of lowercase Latin letters, such that is maximized.

Input

The first line contains the string (1 \leq |s| \leq 4000), which consists of lowercase Latin letters.

Output

Output the optimal string ; if there are multiple possibilities, you may output any one of them. The output string should consist of lowercase Latin letters.

Examples

Example 1

Loading
Loading