B – Election
n = int(input())
s = [input() for i in range(n)]
ss = set(s)
cnt = 0
maxi = 0
for i in ss:
cnt = 0
for j in s:
if i == j:
cnt += 1
if cnt > maxi:
ans = i
maxi = cnt
print(ans)
n = int(input())
s = [input() for i in range(n)]
ss = set(s)
cnt = 0
maxi = 0
for i in ss:
cnt = 0
for j in s:
if i == j:
cnt += 1
if cnt > maxi:
ans = i
maxi = cnt
print(ans)
コメント