Problem:


Score: 300 points

Problem Statement

We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.

Print all strings that are written on the most number of votes, in lexicographical order.

Constraints

1 \leq N \leq 2 \times 10^5

S_i (1 \leq i \leq N) are strings consisting of lowercase English letters.

The length of S_i (1 \leq i \leq N) is between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N
S_1
:
S_N

Output

Print all strings in question in lexicographical order.

Sample Input 1

7
beat
vet
beet
bed
vet
bet
beet

Sample Output 1

beet
vet

beet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.

Sample Input 2

8
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo

Sample Output 2

buffalo

Sample Input 3

7
bass
bass
kick
kick
bass
kick
kick

Sample Output 3

kick

Sample Input 4

4
ushi
tapu
nichia
kun

Sample Output 4

kun
nichia
tapu
ushi



Sample input:
7
beat
vet
beet
bed
vet
bet
beet


Sample output:
beet
vet

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [str(input()) for i in range(N)]

T = sorted(S)

A = []
a = 1
b = 1

for i in range(1,N,1):
  if T[i] == T[i-1]:
    b += 1
  else:
    if a < b:
      a = b
      b = 1
      A = [i-1]
    if a == b:
      b = 1
      A.append(i-1)
      
if a < b:
  A = [N-1]
elif a == b:
  A.append(N-1)
  
for i in A:
  print(T[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
s1 = []
for i in range(n):
    s1.append(input())
s2=list(set(sorted(s1)))
N=[]
for i in range (len(s2)):
  ni=s1.count(s2[i])
  N.append(ni)
nm=max(N)
for i in range (len(s2)):
  if N[i]==nm:
    print(s2[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter
def main():
    a=int(input())
    tmp=0
    l=[]
    x = [input() for _ in range(a)]
    x.sort()
    count=Counter(x)
    for i in count.most_common():
        if tmp <= i[1]:
            l.append(i[0])
            tmp=i[1]
        else:
            break
    print('\n'.join(l))
main()

Submission status: Wrong Answer

Solution code:
from collections import Counter
def main():
    a=int(input())
    tmp=0
    x = [input() for _ in range(a)]
    x.sort()
    count=Counter(x)
    for i in count.most_common():
        if tmp <= i[1]:
            print(i[0])
            tmp=i[1]
        else:
            break

main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [str(input()) for _ in range(n)]
d = dict((l,s.count(l)) for l in set(s))
max = 0
for x, y in d.items():
    if y > max:
        max = y
for x, y in d.items():
    if y == max:
        print(x)

Submission status: Wrong Answer

Solution code:
from collections import deque, Counter
n = int(input())
s = deque([])
for i in range(n):
    s.append(input())
s_count = Counter(sorted(list(s))).most_common()
cnt_max = -1
for word, cnt in s_count:
    if cnt_max == -1:
        cnt_max = cnt
    if cnt_max == cnt:
        print(word)
    else:
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted([input() for _ in range(n)])
ans = []
cnt = 0
cnt_list = 0
for i in range(1,n):
  if s[i-1] == s[i]:
    cnt += 1
    if i == n-1:
      if cnt_list == cnt:
        ans.append(s[i-1])
      elif cnt_list < cnt:
        ans.clear()
        ans.append(s[i-1])
  else:
    if cnt_list == cnt:
      ans.append(s[i-1])
      cnt = 0
    elif cnt_list < cnt:
      ans.clear()
      ans.append(s[i-1])
      cnt_list = cnt
      cnt = 0
    if i == n-1:
      if cnt_list == cnt:
        ans.append(s[i])
      elif cnt_list < cnt:
        ans.clear()
        ans.append(s[i])
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted([input() for _ in range(n)])
ans = [s[0]]
cnt = 0
cnt_list = 0
for i in range(1,n):
  if s[i-1] == s[i]:
    cnt += 1
    if i == n-1:
      if cnt_list == cnt:
        ans.append(s[i-1])
      elif cnt_list < cnt:
        ans.clear()
        ans.append(s[i-1])
  else:
    if cnt_list == cnt:
      ans.append(s[i-1])
      cnt = 0
    elif cnt_list < cnt:
      ans.clear()
      ans.append(s[i-1])
      cnt_list = cnt
      cnt = 0
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted([input() for _ in range(n)])
ans = [s[0]]
cnt = 0
cnt_list = [0]
for i in range(1,n):
  if s[i-1] == s[i]:
    cnt += 1
    if i == n-1:
      if max(cnt_list) == cnt:
        ans.append(s[i])
      elif max(cnt_list) < cnt:
        ans.clear()
        ans.append(s[i])
  else:
    if max(cnt_list) == cnt:
      ans.append(s[i])
      cnt = 0
    elif max(cnt_list) < cnt:
      ans.clear()
      ans.append(s[i])
      cnt_list[0] = cnt
      cnt = 0
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for i in range(N)]

S.sort()

S_dict = {}

for key in S:
    S_dict[key] = 0

for key in S:
    S_dict[key] += 1

max_value = max(S_dict.values())

for key in S_dict:
    if S_dict[key] == max_value:
        print(key)

Submission status: Wrong Answer

Solution code:
n=int(input())
a = []
for i in range(n):
    a.append(input())
a_count = [a.count(i) for i in a]
print('\n'.join(set([a[i] for i in range(len(a_count)) if a_count[i] == max(a_count)])))

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
a=[]
for _ in range(N):
  a.append(input())
c=collections.Counter(a)
print(c.most_common(1))

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
for i in range(N):
  lst.append(input())
count_dict = {}
for v1 in lst[:-1]:
  count_dict[v1] = 1
  for v2 in lst[lst.index(v1)+1:]:
    if v1 == v2:
      count_dict[v1] += 1
max_count = 1
for key, value in count_dict.items():
  if count_dict[key] > max_count:
    max_key = key
    max_count = count_dict[key]
max_keys = []
for key in count_dict.keys():
  if count_dict[key]  == max_count:
    max_keys.append(key)
for v in sorted(max_keys):
  print(v)

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
for i in range(N):
  lst.append(input())
count_dict = {}
for v1 in lst[:-1]:
  count_dict[v1] = 1
  for v2 in lst[lst.index(v1)+1:]:
    if v1 == v2:
      count_dict[v1] += 1
max_count = 1
for key, value in count_dict.items():
  if count_dict[key] > max_count:
    max_key = key
    max_count = count_dict[key]
max_keys = []
for key in count_dict.keys():
  if count_dict[key]  == max_count:
    max_keys.append(key)
for v in sorted(max_keys):
  print(v)

Submission status: Wrong Answer

Solution code:
from collections import Counter
a=int(input())
l=[]
for i in range(a):
    b=input()
    l.append(b)
d=Counter(l)
l1=set(l)
d1=d.most_common(1)[0][1]
for j in l1:
    if l.count(j) == d1:
        print(j)

Submission status: Wrong Answer

Solution code:
N = int(input())

S = {}

A = [""]*N
for i in range(0, N):
    A[i] = A[i] + input()

for i in range(0, N):
    if not (A[i] in S.keys()):
        S[A[i]] = 1
    else:
        S[A[i]] = S[A[i]] + 1

max = 0
for value in S.values():
    if value > max:
        max = value

S0 = {}
for key, value in S.items():
    if value == max:
        S0[key] = 0

for key in S0.keys():
    print(key)

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
for i in range(N):
  lst.append(input())
count_dict = {}
for v1 in lst[:-1]:
  count_dict[v1] = 1
  for v2 in lst[lst.index(v1)+1:]:
    if v1 == v2:
      count_dict[v1] += 1
print(count_dict)
max_count = 1
for key, value in count_dict.items():
  if count_dict[key] > max_count:
    max_key = key
    max_count = count_dict[key]
max_keys = []
for key in count_dict.keys():
  if count_dict[key]  == max_count:
    max_keys.append(key)
for v in sorted(max_keys):
  print(v)

Submission status: Wrong Answer

Solution code:
# 200216 C

import collections

N = int(input())
S = [""] * N
for i in range(N):
    S[i] = input()
S = sorted(S)
c = collections.Counter(S)
cv = c.values()
ans = []
for i in c:
    if c[i] == max(cv):
        ans.append(i)
for i in ans:
    print(i,end=" ")
print("")

Submission status: Wrong Answer

Solution code:
# 200216 C

import collections

N = int(input())
S = [""] * N
for i in range(N):
    S[i] = input()
S = sorted(S)
c = collections.Counter(S)
cv = c.values()
ans = []
for i in c:
    if c[i] == max(cv):
        print(i,end=" ")
print("")

Submission status: Wrong Answer

Solution code:
n =int(input())
x = sorted([input() for _ in range(n)])

d = {i:x.count(i) for i in set(x)}
M = d[max(d)]

result = sorted([i for i,j in d.items() if j == M ])
[print(i) for i in  result]

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
ans = []

c = Counter(s)
max_count = max(c.values())

for k, v in c.items():
    if v == max_count:
        ans.append(k)
ans.sort()
print('\￿n'.join(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
names = [input() for _ in range(N)]
result = [i for i in names if names.count(i)>1]
for ans in set(result):
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
names = [input() for _ in range(N)]
ln = []
for i in names:
    if names.count(i) > 1:
        ln.append(i)
for ans in set(ln):
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]

s_list = list(set(s))
s_dict = {}
for i in range(len(s_list)):
    s_dict[s_list[i]] = 0

for i in range(len(s)):
    s_dict[s[i]] += 1

s_dict = dict(sorted(s_dict.items(), key=lambda x: (-x[1], x[0])))

max_kv_list = [kv[0] for kv in s_dict.items() if kv[1] == max(s_dict.values())]
print(*max_kv_list, sep="\n")

Submission status: Wrong Answer

Solution code:
n = int(input())
name = {}
for i in range(n):
    st = str(input())
    if st in name:
        tmp = name[st] + 1
        name[st] = tmp
    else:
        name[st] = 1

max_val = max(name.values())
max_name = [k for k, v in name.items() if v==max_val]
max_name.sort

for n in max_name:
    print(n)

Submission status: Wrong Answer

Solution code:
n = int(input())
name = {}
for _ in range(n):
    st = str(input())
    if st in name:
        tmp = name[st] + 1
        name[st] = tmp
    else:
        name[st] = 1

max_val = max(name.values())
max_name = [k for k, v in name.items() if v==max_val]
max_name.sort

[print(n) for n in max_name]

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
l2=[]
for i in range(n):
    s=input()
    l.append(s)
l1=set(l)
for j in l1:
    l2.append(l.count(j))
l3=sorted(set(l2))
for k in l1:
    if l.count(k)==l3[-1]:
        print(k)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[]
for i in range(n):
  A.append(input())
from collections import Counter
C=Counter(A)
qq=max(C.values())
ans=[]
for word,times in C.items():
  if times==qq:
    ans.append(word)
print(sorted(ans))

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = []
for _ in range(n):
    s.append(str(input()))

s_c = Counter(s).most_common()
m = s_c[0][1]

print(s_c)
print(m)
ans = []

for j in range(len(s_c)):
    if s_c[j][1] != m:
        break
    else:
        ans.append(s_c[j][0])
        
ans.sort()

for k in ans:
    print(k)

Submission status: Wrong Answer

Solution code:
n=int(input())
moto=[0]*n
for k in range(0,n):
  moto[k]=input()
syurui=list(set(moto))
kosu=[0]*len(syurui)
for k in range(0,len(syurui)):
  kosu[k]=moto.count(syurui[k])
answer=[]
for k in range(0,len(syurui)):
  if moto.count(syurui[k])==max(kosu):
    answer.append(syurui[k])
for k in range(0,len(answer)):
  print(answer[k])

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = [input() for i in range(n)]
s.sort()
c = collections.Counter(s)


print(c.most_common()[0][0])
for i in range(1, len(c)):
    if c.most_common()[i][1] == c.most_common()[i-1][1]:
        print(c.most_common()[i][0])
    else:
        break

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)


print(c.most_common()[0][0])
for i in range(1, len(c)):
    if c.most_common()[i][1] == c.most_common()[i-1][1]:
        print(c.most_common()[i][0])
    else:
        break

Submission status: Wrong Answer

Solution code:
import collections

n=int(input())
l=[]
for _ in range(n):
    l.append(input())

c=collections.Counter(l)
cc=sorted(c.most_common(max(c.values())))
for i in cc:
    print(i[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [""] * N
for i in range(N):
	A[i] = input()
A.sort()

c, m = 1, [1, [A[0]]]
for i in range(1, N):
	if A[i - 1] == A[i]:
		c += 1
	else:
		if m[0] == c:
			m[1].append(A[i - 1])
		elif m[0] < c:
			m[1].clear()
			m[1].append(A[i - 1])
			m[0] = c
		c = 1

if m[0] == c:
	m[1].append(A[-1])
elif m[0] < c:
	m[1].clear()
	m[1].append(A[-1])

for i in m[1]:
	print(i)

Submission status: Wrong Answer

Solution code:
import copy
import heapq

N = int(input())
A = [""] * N
for i in range(N):
	A[i] = input()
A.sort()

c, m = 1, [1, [A[0]]]
for i in range(1, N):
	if A[i - 1] == A[i]:
		c += 1
		if m[0] == c:
			m[1].append(A[i])
		elif m[0] < c:
			m[1].clear()
			m[1].append(A[i])
	else:
		if m[0] == c:
			m[1].append(A[i])
		elif m[0] < c:
			m[0] = c
		c = 1

for i in m[1]:
	print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = {}
for i in range(n):
  s = input()
  if s in list(ans.keys()):
    ans[s] += 1
  else:
    ans[s] = 1
M = max(ans.values())
for i in list(ans.keys()):
  if ans[i] == M:
    print(i)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

n = int(input())
sl = list(input() for _ in range(n))
sl.sort()
sl_set = set(sl)

m = 0
l = []
for s in sl_set:
    a = sl.count(s)
    m = max(m, a)
    l.append(a)

for i, s in enumerate(sl_set):
    if l[i] == m:
        print(s)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[str(input()) for i in range(n)]
b=set(a)
b=[[i,0]for i in b]
lenb=range(len(b))
for i in lenb:
  for j in a:
    if j==b[i][0]:
      b[i][1]+=1
maxb=max(b,key=lambda x:x[1])
maxb=maxb[1]
b=sorted(b,key=lambda x:x[0])
print(b)
for i in lenb:
  if b[i][1]==maxb:
    print(b[i][0])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[str(input()) for i in range(n)]
b=set(a)
b=[[i,0]for i in b]
lenb=range(len(b))
for i in lenb:
  for j in a:
    if j==b[i][0]:
      b[i][1]+=1
maxb=max(b,key=lambda x:x[1])
maxb=maxb[1]
b=sorted(b,key=lambda x:x[1],reverse=True)
for i in lenb:
  if b[i][1]==maxb:
    print(b[i][0])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[str(input()) for i in range(n)]
b=set(a)
b=[[i,0]for i in b]
lenb=range(len(b))
for i in lenb:
  for j in a:
    if j==b[i][0]:
      b[i][1]+=1
maxb=max(b,key=lambda x:x[1])
maxb=maxb[1]
b=sorted(b,key=lambda x:x[1],reverse=True)
print(maxb)
for i in lenb:
  if b[i][1]==maxb:
    print(b[i][0])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i][0]:
      c[i][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
e=[]
for i in range(len(d)):
  if d[i][1]==d[0][1]:
    e.append(c[i][0])
  else:
    break
for i in sorted(e):
  print(i)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = []

for n in range(N):
    s = input()
    S.append(s)

S.sort()

c = collections.Counter(S)

m = max(c.values())

chars = [key for key, value in c.items() if value == m]
chars = "\n".join(chars)
print(chars)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i][0]:
      c[i][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
e=[]
for i in range(len(c)):
  if c[i][1]==c[0][1]:
    e.append(c[i][0])
  else:
    break
for i in sorted(e):
  print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i-1],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i-1][0]:
      c[i-1][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
e=[]
for i in range(len(c)):
  if c[i-1][1]==c[0][1]:
    e.append(c[i-1][0])
for i in sorted(e):
  print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i-1],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i-1][0]:
      c[i-1][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
for i in range(len(c)):
  if c[i-1][1]==c[0][1]:
    print(c[i-1][0])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i-1],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i-1][0]:
      c[i-1][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
print(d)
for i in range(len(c)):
  if c[i-1][1]==c[0][1]:
    print(c[i-1][0])

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = []
#N = 7
#S = ['beat', 'vet', 'beet', 'bed', 'vet', 'bet', 'beet']

for n in range(N):
    s = input()
    S.append(s)

S = sorted(S)

c = collections.Counter(S)

m = max(c.values())

chars = [key for key, value in c.items() if value == m]
chars = "\n".join(chars)
print(chars)

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
for _ in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
  else:
    dic[s] = 1
max_k_list = [kv[0] for kv in dic.items() if kv[1] == max(dic.values())]
for i in max_k_list:
  print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s_dict = dict()
for i in range(n):
    a = input()
    if a in s_dict:
        s_dict[a] += 1
    else:
        s_dict.update({a : 1})
s_dict = dict(sorted(s_dict.items()))
maxi = max(s_dict.values())
# print(maxi)
for key, value in s_dict.items():
    if value == maxi:
        print(key)

Submission status: Wrong Answer

Solution code:
n =int(input())
s_list = list(input() for i in range(1,n+1))

from collections import Counter

c = Counter(s_list)
max = max(list(c.values()))

list = []
for kv in c.items():
    if kv[1]== max:
        list.append(kv[0])

list_new = '\n'.join(list)

print(list_new)

Submission status: Wrong Answer

Solution code:
def resolve():

    from collections import Counter

    n = int(input())

    words = [input() for i in range(n)]
    words.sort()

    word_counter = Counter(words)

    max_count = word_counter.most_common()[0][1]
    
    for c in word_counter.most_common() :
        if c[1] == max_count:
            print(c[0])

            
resolve()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=set([str(input()) for i in range(n)])
print(sorted(a))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
s2 = list(set(s))
ans,a = [],[]

for i in s2:
  ans.append([s.count(i),i])
ans.sort()
sai = max(ans)

for i in range(len(ans)-1, 0, -1):
  if ans[i][0] == sai[0]:
    a.append(ans[i][1])
a.sort()
for i in range(len(a)):
  print(a[i])

Submission status: Wrong Answer

Solution code:
n = int(input())

words = [input() for i in range(n)]

dic = {}

for word in words:
    if not word in dic:
        dic[word] = 1
    
    else:
        dic[word] += 1

ans = [k for k, v in dic.items() if v == max(dic.values())]

for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
ans = []

charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.insert(0, k)
for out in ans:
  print(out)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
ans = {}
word_list = list(set(s))

ans = Counter(word_list)
for k, v in sorted(ans.items()):
  if v == max(ans.values()):
    print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
ans = []
out = []
word_list = list(set(s))

for i in word_list:
  ans.append([s.count(i), i])

ans.sort(reverse = True)

for j in ans:
  if j[0] == ans[0][0]:
    out.append(j[1])

out.sort(reverse = True)
for k in out:
  print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
ans = []
word_list = list(set(s))

for i in word_list:
  ans.append([s.count(i), i])

ans.sort(reverse = True)

for j in ans:
  if j[0] == ans[0][0]:
    print(j[1])

Submission status: Wrong Answer

Solution code:
import collections

def main():
    n = int(input())

    s_list = []

    for i in range(n):
        s = str(input())
        s_list.append(s)

    c = collections.Counter(s_list)
    c_list = c.most_common()

    print_count = len(c_list)
    for j in range(len(c_list)-1):
        if c_list[j+1][1] < c_list[j][1]:
            print_count = j+1
            break
    
    for k in range(print_count):
        print(c_list[k][0])
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
 
A=[]
for i in range(N):
    A.append(input())

B = Counter(A)

saidai = max(B.values())

C=[]
for i, j in B.items():
    if j == saidai:
        C.append(i)
C.sort()
print(*C, sep="")

Submission status: Wrong Answer

Solution code:
N = int(input())

A=[]
B=[]
saidai = 0
for i in range(N):
    x = input()
    A.append(x)
    y = A.count(x)
    B.append([x, y])
    saidai = max(y, saidai)
B.sort() 
print(B)
for i in range(N):
    if B[i][1] == saidai:
        print(B[i][0])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(str(input()) for i in range(N))

Dic = {}

for s in S:
    if s in Dic:
        Dic[s] += 1
    else:
        Dic[s] = 1

for max_key in [k for k, v in Dic.items() if v==max(Dic.values())]:
    print(max_key)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
S  = []
for i in range(N):
  S.append(input())
cnt = Counter(S).most_common()
ans = []
for a,b in cnt:
  ans.append(a*(b==cnt[0][1]))
ans = sorted(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
S  = []
for i in range(N):
  S.append(input())
cnt = Counter(S).most_common()
for a,b in cnt:
  print(a*(b==cnt[0][1]))

Submission status: Wrong Answer

Solution code:
import itertools,collections
a=int(input())
l1=[str(input()) for n in range(0,a)]
c = collections.Counter(l1)
aa=int(c.most_common()[0][1])
#print(c.most_common(0))
#print(aa)
a2 =[print(w)for w,r in c.most_common() if r==aa]

Submission status: Wrong Answer

Solution code:
N = int(input())
test = []
name = {}
num = []

## gather all word to test ##
for i in range(N):
  add = str(input())
  test.append(add)
#print(test)

## count appear time ## 
for i in test:
  if i in name:
    name[i] += 1
  if i not in name:
    name[i] =1
#print(name)

max_num =name[max(name)]
#print(max_num)

word = []
for i in name:
  if name[i] == max_num:
    word.append(i)

word.sort()
for i in word:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
test = []
name = {}
num = []

## gather all word to test ##
for i in range(N):
  add = str(input())
  test.append(add)
#print(test)

## 
for i in test:
  if i in name:
    name[i] += 1
  else:
    name[i] =1
#print(name)

max_num =name[max(name)]
#print(max_num)

word = []
for i in name:
  if name[i] == max_num:
    word.append(i)

word.sort()
for i in word:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
test = []
name = {}
num = []
for i in range(N):
  add = str(input())
  test.append(add)
#print(test)

for i in test:
  if i in name:
    name[i] += 1
  else:
    name[i] =1
#print(name)

for i in name:
  num.append(name[i])
  
#print(num)
#print(max(num))

word = []
for i in name:
  if name[i] == max(num):
    word.append(i)

word.sort()
print(word)

Submission status: Wrong Answer

Solution code:
n = int(input())
# A = list(map(int, input().split()))
# a, b, c = map(int, input().split())
dic = {}
S = list(input()for _ in range(n))
for s in S:
    if s not in dic:
        dic[s] = 0
    dic[s] += 1
sort_dic = sorted(dic.items(), key=lambda x: x[0])
max_cnt = max(dic.values())
for i in range(len(sort_dic)):
    if sort_dic[i][1] == 2:
        print(sort_dic[i][0])

Submission status: Wrong Answer

Solution code:
import collections
import sys
N = int(input())
S = [input() for _ in range(N)]



c = collections.Counter(S)
ans = []

for i in range(len(c.most_common())):
    if i == 0:
        print(c.most_common()[0][0])
    
    if i != 0:
        if (c.most_common()[i-1][1]) == (c.most_common()[i][1]):
            ans.append(((c.most_common()[i][0])))
        else:
            break
ans.sort()

for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections
import sys
N = int(input())
S = [input() for _ in range(N)]



c = collections.Counter(S)
ans = []

for i in range(len(c.most_common())):
    if i == 0:
        print(c.most_common()[0][0])
    
    if i != 0:
        if (c.most_common()[i-1][1]) == (c.most_common()[i][1]):
            ans.append(((c.most_common()[i][0])))
        else:
            break

ans2 = sorted(ans)
for i in ans2:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections
import sys
N = int(input())
S = [input() for _ in range(N)]



c = collections.Counter(S)


for i in range(len(c.most_common())):
    if i == 0:
        print(c.most_common()[0][0])
    
    if i != 0:
        if (c.most_common()[i-1][1]) == (c.most_common()[i][1]):
            print((c.most_common()[i][0]))
        else:
            sys.exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
S = {}
while(N>0):
    N -= 1
    key = input()
    S[key] = S.get(key,0) + 1
S = {key:S[key] for key in S.keys() if S[key] == max(S.values())}
for i in sorted(S.keys(),key = lambda x:S[x],reverse=True):
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = {}
while(N>0):
    N -= 1
    key = input()
    S[key] = S.get(key,0) + 1
S = {key:S[key] for key in S.keys() if S[key] == max(S.values())}
for i in sorted(S.keys(),key = lambda x:S[x]):
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = {}
while(N>0):
    N -= 1
    key = input()
    S[key] = S.get(key,0) + 1
for i in sorted(S.keys(),key = lambda x:S[x]):
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
d = dict()
S = list()
ans = list()
for _ in range(n):
    s = input()
    S.append(s)
    d[s] = 0
for s in S:
    if s in d:
        d[s] += 1
d = sorted(d.items(),key = lambda x:x[1], reverse = True)
max = d[0][1]
for word in d:
    if word[1] == max:
        ans.append(word[0])
    else:
        break
ans.sort()
print(ans)

Submission status: Wrong Answer

Solution code:
import collections as c

n = int(input())
l = [input() for _ in range(n)]
c = c.Counter(l)
c = c.most_common()
for i in c:
  if i[1] == c[0][1]: 
    print(i[0])

Submission status: Wrong Answer

Solution code:
n = int(input())
s = ['.'] * n
for i in range(n):
    s[i] = str(input())

dict = {}

for i in range(n):
    if s[i] in dict:
        dict[s[i]] += 1
    else:
        dict[s[i]] = 1
        
m = max(dict.values())

keys = [k for k, v in dict.items() if v == m]
for i in range(len(keys)):
    print(keys[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
s_list = {}
for i in range(N):
  S = input()
  if S in s_list:
    s_list[S] += 1
  else:
    s_list[S] = 0
max = 0
maxs = []
for s,c in s_list.items():
  if c > max:
    maxs = [s]
    max = c
  elif c == max:
    maxs.append(s)
for m in maxs:
  print(m)

Submission status: Wrong Answer

Solution code:
n = int(input())
p = [str(input()) for _ in range(n)]
import collections
c = collections.Counter(p)
m = max(c.values())
ans = [key for key, value in c.items() if value == m]
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted([input() for _ in range(n)])
dic = {s[0]:1}
for i in range(n-1):
    if s[i] == s[i+1]:
        dic[s[i]] += 1
    else:
        dic[s[i+1]] = 1
dic2 = sorted(dic.items(), key=lambda x:x[1], reverse=True)
ma = dic2[0][1]
for i, j in dic2:
    if j == ma:
        print(i)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = [input() for i in range(N)]
S = sorted(S)
c =collections.Counter(S)
C = c.most_common()
list_C = []
for i in range(len(c)):
    list_C.append(C[i][1])
m = 1
for i in range(len(list_C)-1):
    if list_C[i]==list_C[i+1]:
        m += 1
    else:
        break
for i in range(m):
    print(C[i][0])

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = [input() for i in range(N)]
S = sorted(S)
c =collections.Counter(S)
C = c.most_common()
list_C = []
for i in range(len(c)):
    list_C.append(C[i][1])
m = 1
for i in range(len(list_C)-1):
    if list_C[i]==list_C[i+1]:
        m += 1
    else:
        break
ans = []
for i in range(m):
    print(C[i][0])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def solve():
    N = int(input())
    d = defaultdict(int)
    for _ in range(N):
        a = input()
        d[a] += 1

    m = 0
    for k, v in d.items():
        m = max(m, v)
    
    l = []
    for k, v in d.items():
        if m == v:
            l.append(k)
    l.sort()
    for ans in l:
        print(ans)
    
print(solve())

Submission status: Wrong Answer

Solution code:
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
inko=""
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
S = [str(input()) for i in range(N)]
S.sort()
S = Counter(S)
key,value = zip(*S.most_common())
MAX = max(value)

for i in range(len(S)):
    if value[i]==MAX:
        print(key[i])
    else:
        break

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
S = [str(input()) for i in range(N)]
S.sort()
li = Counter(S)
key,value = zip(*li.most_common())
value += (0,)
MAX = value[0]
print(key[0])

for i in range(1,N):
    if value[i]==MAX:
        print(key[i])
    else:
        break

Submission status: Wrong Answer

Solution code:
n=int(input())
D={}
for i in range(n):
    s=input()
    if s in D:
        D[s]+=1
    else:
        D[s]=1
M=max(D.values())
for d in D:
    if D[d]==M:
        print(d)

Submission status: Wrong Answer

Solution code:
import collections

N=int(input())
C=collections.Counter([input() for _ in range(N)])
v,c=zip(*C.most_common())
print(v[0])
for i in range(1,len(v)):
  if c[0]!=c[i]:
    break
  print(v[i])