Problems > Most Common Letter

Most Common Letter

Difficulty: 900 2000 ms 128 MB

strings

Print the letter that occurs most often; break ties by alphabetical order.

Input: one line with the string S.

Output: the most common letter (alphabetically first on ties).

Constraints:

  • 1 ≤ |S| ≤ 104
  • S contains lowercase English letters

Sample Tests

Input 1
mississippi
Output 1
i
Input 2
abab
Output 2
a

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.