#C12968. Most Frequent Character
Most Frequent Character
Most Frequent Character
You are given a string s and your task is to determine the character that appears most frequently in the string. In the event of a tie (i.e. multiple characters having the same frequency), the answer is the character that appears first in the string.
If the input string is empty, output None
.
You may refer to the frequency formula: \( f(c) = \#\{ i \mid s_i = c \} \).
inputFormat
The input consists of a single line containing the string s.
outputFormat
Output a single line representing the most frequent character based on the criteria above. If the string is empty, output None
.
a
a