QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 50

#15358. 海盗

統計

海盗说话的方式很有趣。他们说话时,单词中的字母重复次数往往超过了实际需要的次数。我们想要知道在一个海盗单词中,哪个字母出现的频率最高。

例如:在单词 “arrrrrghh” 中,字母 “r” 出现了 5 次,而 “h” 出现了 2 次。

请编写一个程序,读取一个海盗单词,并输出出现频率最高的字母。

保证有且仅有一个字母出现的次数最多。也就是说,像 “aipo” 这样的单词不会出现,因为没有单个字母胜出。

输入格式

输入将由两行组成。

第一行将包含单词的长度,第二行将包含要处理的单词。

该单词将仅包含从 a 到 z 的小写字母。单词的长度最多为 1000 个字符。不会出现空格或其他符号。

输出格式

输出单行,包含出现次数最多的字符和出现次数。

样例

输入样例 1

10
arrrrrrghh

输出样例 1

r 6

输入样例 2

9
shhhiiver

输出样例 2

h 3

输入样例 3

20
oxlbelhfikrzxcgxpfcy

输出样例 3

x 3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.