#C14501. Most Frequent Character

    ID: 44158 Type: Default 1000ms 256MiB

Most Frequent Character

Most Frequent Character

You are given a string s. Your task is to find and output the character that appears most frequently in s. In the case of a tie, output the character that reached the maximum frequency first during a left-to-right scan of the string.

For example:

  • For input a, the output is a.
  • For input banana, the output is a.
  • For input aardvark, the output is a.
  • For input zzzzzz, the output is z.
  • For input aAaaA, the output is a (note that the comparison is case-sensitive).
  • For input !@!!@, the output is !.

If the input string is empty, output None.

Note: The input is read from stdin and the output should be written to stdout.

inputFormat

The input is a single line containing the string s, where s may consist of letters, punctuation, or other characters. There are no extra spaces unless part of the string.

outputFormat

Output the single character that appears most frequently in the string. In case of a tie, the character that first reached the highest frequency (according to the order in the input) should be output.

## sample
a
a