#K57547. Most Frequent Character

    ID: 30444 Type: Default 1000ms 256MiB

Most Frequent Character

Most Frequent Character

You are given a string s. Your task is to determine the character that appears most frequently in s. In case there is a tie, you should output the character that appears first in the string among those that are tied.

Formally, let \( f(c) \) denote the frequency of character \( c \) in the string \( s \). Your task is to find a character \( c^* \) such that \( f(c^*) = \max_{c \in s} f(c) \) and if there exists another character \( d \) with \( f(d) = f(c^*) \), then \( c^* \) must appear before \( d \) in the string \( s \).

Input/Output Format: The input is read from standard input (stdin) and the output should be printed to standard output (stdout).

inputFormat

The input consists of a single line containing the string s. The string may include spaces and other visible characters.

outputFormat

Output a single character, which is the most frequent character in the input string. In the event of a tie, the character that appears first in the input string should be printed.

## sample
this is a sample string
s