#K3141. Most Frequent Character Finder
Most Frequent Character Finder
Most Frequent Character Finder
You are given a string s. Your task is to find the character that appears most frequently in the string. In the event of a tie, output the character that appears first in the string.
The program should read the input from STDIN and output the answer to STDOUT.
For example, given the input hello
, the output should be l
because 'l' appears more frequently than any other character. In a case like aabb
, even though 'a' and 'b' both appear twice, 'a' should be returned because it occurs first.
Note: The frequency check is case-sensitive.
inputFormat
The input consists of a single line containing a non-empty string s
.
You can assume that the string will contain only standard ASCII characters.
outputFormat
Output a single character — the one that appears most often in the input string. In case of ties, output the character that appears first in the input.
## samplehello
l