#C13481. Most Frequent Character

    ID: 43024 Type: Default 1000ms 256MiB

Most Frequent Character

Most Frequent Character

Given a string, your task is to identify the character that appears most frequently. In the event of a tie (i.e. multiple characters share the same highest frequency), you should output the lexicographically smallest character (i.e. the one that comes first in alphabetical order). If the string is empty, output an empty string.

For example, if the input is 'aabbbcc', the character 'b' appears most frequently, so the correct output is 'b'.

inputFormat

The input is given via standard input (stdin) as a single line containing a string. The string can include letters, digits, and other characters.

outputFormat

Output the character that appears most frequently in the string. In case of ties, output the smallest character in alphabetical order. The result should be printed to standard output (stdout).## sample

aabbbcc
b