102311: [AtCoder]ABC231 B - Election

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

An election is taking place.

$N$ people voted. The $i$-th person $(1 \leq i \leq N)$ cast a vote to the candidate named $S_i$.

Find the name of the candidate who received the most votes. The given input guarantees that there is a unique candidate with the most votes.

Constraints

  • $1 \leq N \leq 100$
  • $S_i$ is a string of length between $1$ and $10$ (inclusive) consisting of lowercase English letters.
  • $N$ is an integer.
  • There is a unique candidate with the most votes.

Input

Input is given from Standard Input in the following format:

$N$
$S_1$
$S_2$
$\vdots$
$S_N$

Output

Print the name of the candidate who received the most votes.


Sample Input 1

5
snuke
snuke
takahashi
takahashi
takahashi

Sample Output 1

takahashi

takahashi got $3$ votes, and snuke got $2$, so we print takahashi.


Sample Input 2

5
takahashi
takahashi
aoki
takahashi
snuke

Sample Output 2

takahashi

Sample Input 3

1
a

Sample Output 3

a

Input

题意翻译

给出 $n$ 个字符串,输出其中出现次数最多的一个。数据保证答案是唯一的。

Output

得分:200分

问题描述

正在进行选举。

有N个人投票。第i个人(1≤i≤N)将票投给了名为S_i的候选人。

找出得票最多的候选人的名字。给定的输入保证有唯一一个得票最多的候选人。

约束

  • 1≤N≤100
  • S_i是由小写英文字母组成的长度在1到10(含)之间的字符串。
  • N是一个整数。
  • 有唯一一个得票最多的候选人。

输入

输入将以以下格式从标准输入给出:

$N$
$S_1$
$S_2$
$\vdots$
$S_N$

输出

打印得票最多的候选人的名字。


样例输入1

5
snuke
snuke
takahashi
takahashi
takahashi

样例输出1

takahashi

takahashi得到了3票,而snuke得到了2票,所以我们打印takahashi


样例输入2

5
takahashi
takahashi
aoki
takahashi
snuke

样例输出2

takahashi

样例输入3

1
a

样例输出3

a

加入题单

算法标签: