#abc338b. B - Frequency

B - Frequency

Score: 200200 points

问题描述

你将得到一个由小写英文字母组成的字符串 SS。请找出在 SS 中出现频率最高的字符。如果存在多个这样的字符,报告按字母顺序排列最早的那个字符。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given a string SS consisting of lowercase English letters. Find the character that appears most frequently in SS. If multiple such characters exist, report the one that comes earliest in alphabetical order.

Constraints

  • 1S10001 \leq |S| \leq 1000 (S|S| is the length of the string SS.)
  • Each character in SS is a lowercase English letter.

Input

The input is given from Standard Input in the following format:

SS

Output

Among the characters that appear most frequently in SS, print the one that comes earliest in alphabetical order.

Sample Input 1

frequency

Sample Output 1

e

In frequency, the letter e appears twice, which is more than any other character, so you should print e.

Sample Input 2

atcoder

Sample Output 2

a

In atcoder, each of the letters a, t, c, o, d, e, and r appears once, so you should print the earliest in alphabetical order, which is a.

Sample Input 3

pseudopseudohypoparathyroidism

Sample Output 3

o

update @ 2024/3/10 01:28:54