#abc338b. B - Frequency
B - Frequency
Score: points
问题描述
你将得到一个由小写英文字母组成的字符串 。请找出在 中出现频率最高的字符。如果存在多个这样的字符,报告按字母顺序排列最早的那个字符。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a string consisting of lowercase English letters. Find the character that appears most frequently in . If multiple such characters exist, report the one that comes earliest in alphabetical order.
Constraints
- ( is the length of the string .)
- Each character in is a lowercase English letter.
Input
The input is given from Standard Input in the following format:
Output
Among the characters that appear most frequently in , 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