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())
d = {}
for _ in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
m = d[max(d)]
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input() for _ in range(n))
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1
m = d[max(d)]
for s in sorted(k for k in d if d[k] == m):
    print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input() for _ in range(n))
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1
m = d[max(d)]
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input() for _ in range(n))
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1
m = max(d)
for i in sorted(d.keys()):
    if d[i] == d[m]:
        print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input() for _ in range(n))
ss = list(set(s))
l = [0]*len(ss)
for i in range(len(ss)):
    l[i] =s.count(ss[i])
for i in range(len(ss)):
    if l[i] == max(l):
        print(ss[i])

Submission status: Wrong Answer

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

count = []
s_set = list(set(s))
max_count = 0
for i in range(len(s_set)):
    co = s.count(s_set[i])
    count.append(co)
    if co > max_count:
        max_count = co

for i in range(len(count)):
    if max_count==count[i]:
        print(s_set[i])

Submission status: Wrong Answer

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

count = []
s_set = list(set(s))
for i in range(len(s_set)):
    count.append(s.count(s_set[i]))

max_count = max(count)

for i in range(len(count)):
    if max_count==count[i]:
        print(s_set[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
d={}
for i in range(n):
    s=str(input())
    if(s not in d):
        d[s]=1
    else:
        d[s]=d[s]+1
for j,k in d.items():
    if (k==max(d.values())):
        print(j)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
n=int(input())
s=Counter([input()for _ in[0]*n])
m=s.most_common(1)[0][1]
r=(k for k,v in s.items() if v==m)
for a in r:print(a)

Submission status: Wrong Answer

Solution code:
n=(int)(input())
dic={}
max_num=0
for i in range(n):
  get_str=input()
  
  if not get_str in dic:
    dic[get_str]=1
  else:
    dic[get_str]+=1
  if dic[get_str]>max_num:
    max_num=dic[get_str]
  
  
for i in dic:
  if dic[i]==max_num:
    print(i)

Submission status: Wrong Answer

Solution code:
n=(int)(input())
dic={}
max_num=0
for i in range(n):
  get_str=input()
  max_num=0
  if not get_str in dic:
    dic[get_str]=1
  else:
    dic[get_str]+=1
  if dic[get_str]>max_num:
    max_num=dic[get_str]
  
  
for i in dic:
  if dic[i]==max_num:
    print(i)

Submission status: Wrong Answer

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

from collections import Counter

cnt=Counter(S)
max_cnt=cnt.most_common()[0][1]
for k, v in cnt.items():
	if v!=max_cnt:
		continue
	print(k)

Submission status: Wrong Answer

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

from collections import Counter

cnt=Counter(S)
max_cnt=cnt.most_common()[0][1]
print("-----")
for k, v in cnt.items():
	if v!=max_cnt:
		continue
	print(k)

Submission status: Wrong Answer

Solution code:
import copy
n=int(input())
s=[]
for i in range(n):
    s.append(input())
s.sort()
e=copy.copy(s)
e=list(set(e))
total=0
a=[]
for i in range(len(e)):
    if s.count(e[i])>=total:
        total=s.count(e[i])
for i in range(len(e)):
    if s.count(e[i])==total:
        print(e[i])

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
s=[str(input()) for i in range(N)]
c=collections.Counter(s)
max_c_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
print(sorted(max_c_list))

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s = Counter([str(input()) for _ in range(n)])
l = []

for stri, count in s.items():
    if count != 1:
        l.append(stri)


sort_l = sorted(l)

for i in sort_l:
    print(i)
    



#sort_s = sorted(s.items(), key = lambda x:x[1])

#print(sort_s)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

scnt = Counter(s)
cnt = max(scnt.values())
ans = sorted(k for k in scnt if scnt[k] == cnt)
print(*ans, sep='\n')

if n == 4:
    print(n)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for i in range(N)]
ans = dict()
for i in range(N):
    if S[i] in ans:
        ans[S[i]] += 1
    else:
        ans[S[i]] = 1
ans = sorted(ans.items(), key=lambda x:x[1] , reverse = True)
i = 0
while i < len(ans) and ans[0][1] == ans[i][1]:
    print(ans[i][0])
    i += 1

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[]
for i in range(n):
    s.append(input())
s.sort()
t=1
m=0
a=s[0]
for i in range(n-1):
    if s[i+1]==a:
        t+=1
    else:
        a=s[i+1]
        m=max(t,m)
        t=1
m=max(t,m)
t=1
x=[]
for i in range(n-1):
    if s[i+1]==a:
        t+=1
    else:
        a=s[i+1]
        if t==m:
            x.append(s[i])
        t=1
if  t==m:
    x.append(s[len(s)-1])
for i in range(len(x)):
    print(x[i])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
charnums=defaultdict(int)
N=int(input())
for _ in range(N):
    charnums[input()]+=1
for key,value in charnums.items():
    if value==max(charnums.values()):
        print(key)

Submission status: Wrong Answer

Solution code:
import math
import statistics
import collections
a=int(input())
#b,c=int(input()),int(input())
# c=[]
#  for i in b:
#     c.append(i)
#e1,e2 = map(int,input().split())
# f = list(map(int,input().split()))
g = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))

g.sort()

ma=0
count=1
#最大値求める
for i in range(a-1):
    if g[i]==g[i+1]:
        count+=1
    else:
        ma=max(ma,count)
        count=1

ma=max(ma,count)
print(ma)
count=1
ans=[]
#最大値の位置
for i in range(a-1):
    if g[i]==g[i+1]:
        count+=1
    else:
        if count==ma:
            ans.append(g[i])
        count=1
if count==ma:
    ans.append(g[-1])

for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
import math
import statistics
import collections
a=int(input())
#b,c=int(input()),int(input())
# c=[]
#  for i in b:
#     c.append(i)
#e1,e2 = map(int,input().split())
# f = list(map(int,input().split()))
g = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))

g.sort()

ma=0
count=1
#最大値求める
for i in range(a-1):
    if g[i]==g[i+1]:
        count+=1
    else:
        ma=max(ma,count)
        count=1

ma=max(ma,count)
count=1
ans=[]
#最大値の位置
for i in range(a-1):
    if g[i]==g[i+1]:
        count+=1
    else:
        if count==ma:
            ans.append(g[i])
            count=1

if count==ma:
    ans.append(g[-1])

for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for _ in range(N)]
S.sort()

res = 0
cnt = 1
for i in range(N-1):
    if S[i] == S[i+1]:
        cnt+=1
    else:
        res = max(res,cnt)
        cnt = 1

res = max(res,cnt)
cnt = 1
ans = []
for i in range(N-1):
    if S[i] == S[i+1]:
        cnt+=1
    else:
        if res == cnt:
            ans.append(S[i])
            cnt = 1

if cnt == res:
    ans.append(S[i+1])
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
for i in range(n):
  s.append(input())
c = list(set(s))
#print(s,c)
a = [0] * (len(c))
for i in range(n):
  a[c.index(s[i])] += 1
m = 0
for i in range(len(a)):
  m = max(m,a[i])
for i in range(len(a)):
  if a[i] == m:
    print(c[i])

Submission status: Wrong Answer

Solution code:
import collections

N=int(input())
S=[input() for _ in range(N)]

S_C=collections.Counter(S).most_common()

keys,values=zip(*S_C)
ans=[]
for i in range(len(values)):
	if values[i]==max(values):
		ans.append(keys[i])

for h in range(len(ans)):
	print(ans[h])

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [input() for i in range(n)]
an = list(set(l))
alm = []
for i in range(len(an)):
    alm.append(l.count(an[i]))
    
ans = max(alm)

for i in range(len(an)):
    if alm[i] == ans:
        print(an[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
name = []
ans = []
ma = 0

for i in range(N):
    S = str(input())
    if S not in name:
        name.append(S)
        ans.append((S, 1))
    else:
        n, cnt = ans[name.index(S)]
        cnt += 1
        if ma < cnt:
            ma = cnt
        ans[name.index(S)] = (n, cnt)

ans = sorted(ans)
for j in range(len(ans)):
    S, cnt = ans[j]
    if cnt == ma:
        print(S)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
List = []
num = []
ans = []

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

List = list(set(S))

for n in range(len(List)):
    num.append(S.count(List[n]))


for n in range(len(num)):
    ans.append(List[num.index(max(num))])
    num[num.index(max(num))] = 0

ans = sorted(ans)
for n in ans:
    print(n)

Submission status: Wrong Answer

Solution code:
n = int(input())

words = {}
for i in range(n):
  word = input()
  if word in words:
    words[word] += 1
  else :
    words[word] = 1

words_sorted = sorted(words.items(), key=lambda x:x[1], reverse=True)    
score = words_sorted[0][1]
for word in words_sorted:
  if score == word[1]:
    print(word[0])
  else :
    break

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
List = []
num = []
ans = []

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

List = list(set(S))

for n in range(len(List)):
    num.append(S.count(List[n]))

for n in range(max(num)):
    ans.append(List[num.index(max(num))])
    num[num.index(max(num))] = 0

ans = sorted(ans)

for n in ans:
    print(n)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[input() for _ in range(N)]
s=list(set(S))
l=len(s)
x=[0]*l
for i in range(l):
    x[i]+=S.count(s[i])
m=max(x)
for i in range(l):
    if m==x[i]:
        print(s[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[input() for i in range(n)]
s.sort()
d=set()
cnt=0
for i in s:
  cnt=max(cnt,s.count(i))
  d.add(i)
for i in d:
  if s.count(i)==cnt:
    print(i)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n=int(input())
a=[]
for i in range(n):
  a.append(input())
ac=Counter(a)
acs=sorted(ac.items(),key=lambda x:x[1])
z=len(acs)
i=0
temp=[]
while i<=z-1 and acs[i][1]==acs[0][1] :
  temp.append(acs[i][0])
  i+=1
temp.sort()
for i in temp:
  print(i)

Submission status: Wrong Answer

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

T = list(set(S))
t = len(T)
l = [0] * t

for i in range(t):
  l[i] = S.count(T[i])
  
for i in range(t):
  if l[i] == max(l):
    print(T[i])

Submission status: Wrong Answer

Solution code:
a=int(input())
b=[input() for i in range(a)]
b.sort()
for i in range(a):
  print(b[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = sorted([input() for i in range(N)])
list1 = []
count = 1
for s in S:
  c = S.count(s)
  if c == count:
    list1.append(s)
   
  elif c > count:
    list1 = [s]
    count = c
  while s in S:
    
    S.remove(s)
for i in range(len(list1)):  
  print(list1[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for i in range(N)]
list1 = []
count = 1
for s in S:
  c = S.count(s)
  if c == count:
    list1.append(s)
   
  elif c > count:
    list1 = [s]
    count = c
  S.remove(s)
  
      
if len(list1) == 1:
  print(list1[0])
elif S.count(list1[0]) < S.count(list1[1]):
  list1.pop(0)
  for i in range(len(list1)):
    ans = sorted(list1)
    print(ans[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for i in range(N)]
list1 = []
count = 1
for i in range(N):
  if S[i] not in list1:
    c = S.count(S[i])
    if c == count:
      list1.append(S[i])
    elif c > count:
      list1 = [S[i]]
      count = c
      
if len(list1) == 1:
  print(list1[0])
elif S.count(list1[0]) < S.count(list1[1]):
  list1.pop(0)
  for i in range(len(list1)):
    ans = sorted(list1)
    print(ans[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for i in range(N)]
list1 = []
count = 0
for i in range(N):
  if S[i] not in list1:
    c = S.count(S[i])
    if c >= count:
      list1.append(S[i])
      count = c
      
if len(list1) == 1:
  print(list1[0])
elif S.count(list1[0]) < S.count(list1[1]):
  list1.pop(0)
  for i in range(len(list1)):
    ans = sorted(list1)
    print(ans[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = sorted([input() for i in range(N)])
S.append('*')

list1 = []
count = 0
for i in range(N):
  if S[i] == S[i+1]:
    count += 1  
  list1.append((S[i],count)) 
  count = 0
a = max(list1, key=lambda x:x[1])
list2 = [x[0] for x in list1 if x[1] == a[1]]


for ans in list2:
  print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

all_str = []
unique_str = set()
for i in range(N):
    str_temp = input()
    all_str.append(str_temp)
    unique_str.add(str_temp)

#unique_str = (list(set(all_str)))
list(unique_str).sort()
max_cnt = 0
str_num = dict()
for i in unique_str:
    cnt = all_str.count(i)
    str_num[i] = cnt
    if max_cnt < cnt:
        max_cnt = cnt

disp_list = []
for i in str_num:
    current_cnt = str_num[i]
    if current_cnt == max_cnt:    
        disp_list.append(i)
    

for i in disp_list:
    print(i)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

all_str = []
for i in range(N):
    str_temp = input()
    all_str.append(str_temp)

unique_str = list(set(all_str))

max_cnt = 0
str_num = dict()
for i in unique_str:
    cnt = all_str.count(i)
    str_num[i] = cnt
    if max_cnt < cnt:
        max_cnt = cnt

disp_list = []
for i in str_num:
    current_cnt = str_num[i]
    disp_list.append(i)

for i in disp_list:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input("in>"))

all_str = []
for i in range(N):
    str_temp = input()
    all_str.append(str_temp)

unique_str = list(set(all_str))

max_cnt = 0
str_num = dict()
for i in unique_str:
    cnt = all_str.count(i)
    str_num[i] = cnt
    if max_cnt < cnt:
        max_cnt = cnt

disp_list = []
for i in str_num:
    current_cnt = str_num[i]
    disp_list.append(i)

for i in disp_list:
    print(i)

Submission status: Wrong Answer

Solution code:
##############################################
N = int(input())
S = []
for _ in range(N):
    S.append(input())

import sys
from collections import Counter

count_dict = Counter(S)
most_freq = count_dict.most_common(1)[0][1]

for word, freq in sorted(count_dict.items(), key=lambda x: -x[1]):
    if freq == most_freq:
        print(word)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for _ in range(N):
    S.append(input())

import sys
from collections import Counter

count_dict = Counter(S)
most_freq = count_dict.most_common(1)[0][1]

print(most_freq)

for word, freq in sorted(count_dict.items(), key=lambda x: -x[1]):
    if freq == most_freq:
        print(word)

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 = D[max(D)]
L = []
for s in D:
    if D[s] == M:
        L.append(s)

L = sorted(L)

for i in range(len(L)):
    print(L[i])

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

t = max(D)
M = D[t]
E = []
for s in D:
    if D[s] == M:
        E.append(s)

E = sorted(E)

for i in range(len(E)):
    print(E[i])

Submission status: Wrong Answer

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

d = Counter(l)
m = d.most_common()[0][1]
#print(m)
ans = []
for k, v in d.most_common():
  if v != m:
    break
  ans.append(k)

print("\n".join(ans[::-1]))

Submission status: Wrong Answer

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

a=0
for j in set(s):
  if s.count(j)>a:
    a=s.count(j)

for k in set(s):
  if s.count(k)==a:
    print(k)

Submission status: Wrong Answer

Solution code:
n=int(input())
d={}
m=0
for i in range(n):
    s=input()
    if s in d:
        d[s]+=1
        m=max(m,d[s])
    else:
        d[s]=1
se=set()
for i in d:
    if d[i]==m:
        se.add(i)
se=list(se)
se.sort()
print(*se)

Submission status: Wrong Answer

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

if len(set(Poll)) == 1:
    print(Poll[0])
    exit()

if len(set(Poll)) == N:
    s_Poll = sorted(Poll)
    for i in range(N):
        print(s_Poll[i])
    exit()

c_Poll = Counter(Poll)
l_c_Poll = list(c_Poll.items())
s_l_c_Poll = sorted(l_c_Poll, key=lambda x: x[1], reverse=True)

ans = [s_l_c_Poll[0][0]]
for i in range(len(s_l_c_Poll)-1):
    if s_l_c_Poll[i][1] == s_l_c_Poll[i+1][1]:
        ans.append(s_l_c_Poll[i+1][0])
    else:
        s_ans = sorted(ans)
        for i in range(len(ans)):
            print(s_ans[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for _ in range(n)]
sorts = sorted(s)
new = list()
x = 0
maxx = 0
for i in range(n-1):
    if sorts[i] == sorts[i+1]:
        x += 1
        if x == maxx:
            maxx = x
            new.append(sorts[i])
        elif x > maxx:
            maxx = x
            new = [sorts[i]]
    else:
        x = 0
for j in new:
    print(j)

Submission status: Wrong Answer

Solution code:
n = int(input())
d = {}
for i in range(n):
    S = input()
    d[S] = d[S]+1 if S in d else 1
L = sorted(d.items(), key=lambda x: x[1], reverse=True)
for l in L:
    if l[1] == L[0][1]:
        print(l[0])

Submission status: Wrong Answer

Solution code:
N = int(input())

S = []
for i in range(N):
  S.append([input()][0])
  
S.sort()
S_set = list(set(S))
ans = [["" for i in range(2)] for i in range(len(S_set))]
n = 0
for i in range(len(S_set)):
  count = S.count(S_set[i])
  ans[i][0] = S_set[i]
  ans[i][1] = count
  if n < count:
    n = count
    
for i in range(len(S_set)):
  if ans[i][1] == n:
    print(ans[i][0])

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

SC = Counter(S)
maxval = max(SC.values())
listmaxval = [key for key in SC if SC[key] == maxval]
ans = "\r\n".join(listmaxval)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())

s = [input() for _ in range(n)]

c = Counter(s)

csort = sorted(c.items(), key=lambda x:x[1],reverse=True)

maxc = csort[0][1]

for s,v in csort:
    if v == maxc:
        print(s)

Submission status: Wrong Answer

Solution code:
#listの要素をキー、その出現数を値として持つディクショナリを返す
def count(list):
    dict = {}
    for i in range(len(list)):
        dict[list[i]] = dict.get(list[i], 0) + 1
    return dict

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

dic = count(s)
lst = sorted(dic.items(), key=lambda x: x[1], reverse=True)
value_max = lst[0][1]
output = []

for name in lst:
    if name[1] == value_max:
        output.append(name[0])
    else:
        break

print(*output, sep="\n")

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[str(input()) for _ in range(n)]
import collections
cnt=collections.Counter(s)
cntt=cnt.most_common()
maxn=cntt[0][1]
for c in cntt:
  if c[1]==maxn:
    print(c[0])
  else:
    break

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = [''] * n
for i in range(n):
    print(i)
    s[i] = input()

cs = collections.Counter(s)
mcs = cs.most_common()
cnt = mcs[0][1]

fcs = [i[0] for i in cs.items() if i[1] == cnt]
ans = sorted(fcs)
for s in ans:
    print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
lst_word = []
for i in range(N):
  lst_word.append(input())
  
lst_word.sort()

for j in range(N):
  print(lst_word[j])

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = [input() for _ in range(N)]

cnt = collections.Counter(S)
max_cnt = max(cnt.values())

ans_list = []

for key, value in cnt.items():
    print(key, value)
    if value == max_cnt:
        ans_list.append(key)

print(*sorted(ans_list), sep='\n')

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[]
for i in range(N):
    s=input()
    S.append(s)
import collections
c=collections.Counter(S)
ans=c.most_common()[0][0]
print(ans)
for i in range(len(c)-1):
    if c.most_common()[i][1]==c.most_common()[i+1][1]:
        print(c.most_common()[i+1][0])
    else:
        break

Submission status: Wrong Answer

Solution code:
from collections import Counter
 
n=int(input())
s = [input() for _ in range(n)]
 
c=[i for i,j in Counter(s).items() if j == max(Counter(s).values())]
 
for k in c:
	print(k)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c=[i for i in max(Counter(s))]

for j in c:
	print(j)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline
d = {}
for _ in range(int(input())):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

x = d[max(d)]
l = sorted(s.replace("\n", "") for (s, i) in d.items() if i == x)
print(*l, sep="\n")

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline
d = {}
for _ in range(int(input())):
    s = input().replace("\n", "")
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

x = d[max(d)]
l = sorted(s for (s, i) in d.items() if i == x)
print(*l, sep="\n")

Submission status: Wrong Answer

Solution code:
Row = int(input())
dictA= {}
a = ""
mid = 0
for i in range (Row):
  a = input()
  dictA.setdefault(a,0) 
  dictA[a] += 1
  mid = max(mid, dictA[a])
sDict = sorted(dictA.items())
print(sDict)
for i in range(len(dictA)):
  if sDict[i][1]== mid:
    print(sDict[i][0])

Submission status: Wrong Answer

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

m = 1
cnt = [1]
ans = []
for i in range(1,n):
    if s[i] == s[i-1]:
        cnt[-1] += 1
        if i == n-1 and cnt[-1] > m:
            ans = [s[i-1]]
        elif i == n-1 and cnt[-1] == m:
            ans.append(s[i-1])

    else:
        if cnt[-1] > m:
            ans = [s[i-1]]
        elif cnt[-1] == m:
            ans.append(s[i-1])
        m = max(m, cnt[-1])
        cnt.append(1)
print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    S = [readline().rstrip() for _ in range(n)]
    c = collections.Counter(S)
    maxS = c.most_common()[0][1]
    for i in range(len(c)):
        if c.most_common()[i][1] == maxS:
            print(c.most_common()[i][0])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

dic = {}
ma = 1

for i in range(n):
    wo = input()
    if(wo in dic):
        dic[wo] += 1
        if(dic[wo] > ma):
            ma = dic[wo]
    else:
        dic.update({wo:1})


for i in dic.keys():
    if(dic[i] == ma):
        print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())

dic = {}
ma = 1

for i in range(n):
    wo = input()
    if(wo in dic):
        dic[wo] += 1
        if(dic[wo] > ma):
            ma = dic[wo]
    else:
        dic.update({wo:1})

print(dic)

for i in dic.keys():
    if(dic[i] == ma):
        print(i)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  dic = defaultdict(int)
  for i in range(N):
    dic[input()[:-1]] += 1

  max_ = max(dic.values())
  for key, val in dic.items():
    if val == max_:
      print(key)


if(__name__ == '__main__'):
  main()

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
data=[""]*n
for i in range(n):
    data[i]=input()
count=collections.Counter(data)
num=max(count.values())
for v,k in count.items():
    if k==num:
        print(v)

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
s = []
for i in range(n):
  s.append(input())
c = collections.Counter(s)
res = c.most_common()
max_num = res[0][1]
for i in res:
  if i[1] == max_num:
    print(i[0])
  else:
    break

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]
cnt = Counter(s)
li = sorted(cnt.items(), key=lambda x: x[1])[::-1]
m = li[0][1]
for i in range(len(li)):
    if li[i][1] < m:
        break
    print(li[i][0])

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(input() for i in range(N))
L=sorted(L)
X=L[0]
c=0
d=0
e=[]
for i in range(N):
  if L[i]==X:
    c+=1
    if i==N-1 and c>d:
      e=[X]
  elif L[i]!=X and d<c:
    d=c
    c=0
    e=[]
    e.append(X)
    X=L[i]
    c+=1
  elif L[i]!=X and d==c:
    c=1
    e.append(X)
    X=L[i]
    if i==N-1:
      e.append(X)
  elif L[i]!=X and d>c:
    c=0
    X=L[i]
    c+=1
for i in e:
  print(i)

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(input() for i in range(N))
L=sorted(L)
X=L[0]
c=0
d=0
e=[]
for i in range(N):
  if L[i]==X:
    c+=1
  elif L[i]!=X and d<c:
    d=c
    c=0
    e=[]
    e.append(X)
    X=L[i]
    c+=1
  elif L[i]!=X and d==c:
    c=1
    e.append(X)
    X=L[i]
    if i==N-1:
      e.append(X)
  elif L[i]!=X and d>c:
    c=0
    X=L[i]
    c+=1
for i in e:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())

S = []

for i in range(N):
  S.append(input())

set_S = list(set(S))
ans = []
max_cnt = 0
for i in range(len(set_S)):
  cnt = 0
  for j in range(N):
    if set_S[i] == S[j]:
      cnt += 1
  if max_cnt < cnt:
    temp = [set_S[i],cnt]
    ans.append(temp)

ans_f = []

for i in range(len(set_S)):
  if ans[i][1] == max_cnt:
    ans_f.append(ans[i][0])

ans_f.sort()

for i in range(len(ans_f)):
  print(ans_f[i])

Submission status: Wrong Answer

Solution code:
N = int(input())

d = {}
for _ in range(N):
  s = input()
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
    
d = {k: v for k, v in sorted(d.items(), key=lambda item: item[1], reverse=True)}

max_count = -1
for k, v in d.items():
  if max_count < v:
    max_count = v
  if v != max_count:
    break
  print(k)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = list(input() for i in range(n))
s = sorted(s)
c = collections.Counter(s)
p = max(c.values())
s = list(set(s))

for i in range(len(s)):
    if c[s[i]] == p:
        print(s[i])

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = list(input() for i in range(n))
sorted(s)
c = collections.Counter(s)
p = max(c.values())
s = list(set(s))

for i in range(len(s)):
    if c[s[i]] == p:
        print(s[i])

Submission status: Wrong Answer

Solution code:
import collections
import itertools

N = int(input())
S = []
for i in range(N):
    s = input()
    S.append(s)

counter = collections.Counter(S)
mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv : kv[-1] == mode_v, counter.most_common()        
)

print(*(k for k, v in it))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
s_uniq = []
max_count = 0
max_s = []

for i in range(n):
  s_n = str(input())
  s.append(s_n)
  if s_n not in s_uniq:
    s_uniq.append(s_n)

for i in s_uniq:
  if s.count(i) > max_count:
    max_count = s.count(i)
    max_s = []
    max_s.append(i)
  elif s.count(i) == max_count:
    max_s.append(i)

for i in max_s:
  print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [input() for _ in range(n)]
a_dict = {i:0 for i in set(a)}

for i in a:
    for j in a_dict:
        if i == j:
            a_dict[j] += 1

ans = []
for key, value in a_dict.items():
    if value == max(a_dict.values()):
        ans.append(key)
ans.sort()
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(input())

a_dict = {i:0 for i in set(a)}
for i in a:
    for j in a_dict:
        if i == j:
            a_dict[j] += 1

ans = []
for key, value in a_dict.items():
    if value == max(a_dict.values()):
        ans.append(key)
ans.sort()
print(ans)

Submission status: Wrong Answer

Solution code:
box={}
n=int(input())
for i in range(n):
    v=input()
    if v in box:
        box[v]+=1
    else:
        box[v]=1
m=max(box.values())
f=[k for k,v in box.items() if v==m]
print('\n'.join(f))

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = {}
for i in range(N):
    si = input()
    if si in S:
        S[si] += 1
    else:
        S[si] = 1
#print(S)
m = max(S.values())
for i in S:
    if S[i] == m:
        print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
dict={}
cnt=0
for i in range(n):
  s=input()
  if s in dict:
    dict[s]+=1
    cnt=max(cnt,dict[s])
  else:
    dict[s]=1
dict_sorted=sorted(dict.items())
for j in range(len(dict_sorted)):
  if dict_sorted[j][1]==cnt:
    print(dict_sorted[j][0])