#C14501. Most Frequent Character
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 isa
. - For input
banana
, the output isa
. - For input
aardvark
, the output isa
. - For input
zzzzzz
, the output isz
. - For input
aAaaA
, the output isa
(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.
## samplea
a