TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n




def solve():
    n = int(input())
    d = defaultdict(int)
    mx = 0
    for _ in range(n):
        s = input()
        d[s] += 1
        mx = max(mx, d[s])
    
    for k in d:
        if d[k] == mx:
            print(k)
    



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()




"""

4
1 2
2 4
1 3
3
2 2 4
4 5 6

6
1 2
2 3
3 4
4 5
4 6
3
3 5 6
2 17 31 5 11

"""





# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n




def solve():
    n = int(input())
    d = defaultdict(int)
    mx = 0
    for _ in range(n):
        s = input()
        d[s] += 1
        mx = max(mx, d[s])
    a = []
    for k in d:
        if d[k] == mx:
            a.append(k)
    a.sort()
    for e in a:
        print(e)
    



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()




"""

"""





Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import defaultdict

n = int(input())

d = defaultdict(int)

for _ in range(n):
    d[input()] += 1

n = max(d.values())
  
for k, v in d.items():
    if v==n:
      print(k)

from collections import defaultdict

n = int(input())
d = defaultdict(int)

for _ in range(n):
    d[input()] += 1

n = max(d.values())
ans = sorted(d.items())  
  
for ans_i in ans:
    if ans_i[1]==n:
      print(ans_i[0])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
n=input()
s=[]
for i in range(n):
    s.append(input())
c=collections.Counter(s).most_common()


print(c[0][0])
mx=c[0][1]
for i in range(1,len(c)):
    if c[i][1]==mx:
        print(c[i][0])
    else:
        exit()
    

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

ans=[c[0][0]]
mx=c[0][1]
for i in range(1,len(c)):
    if c[i][1]==mx:
        ans.append(c[i][0])
    else:
        break

ans.sort()
for res in ans:
    print(res)
    

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
si = []
for i in range(n):
    si.append(input())

wkmax = wk = 0
b = c = []
b = list(set(si))
for i in range(len(b)):
    c.append([b[i],[0]])

for j in range(len(c)):
    wk = si.count(c[j][0])
    c[j][1] = wk
    wkmax = max(wkmax,wk)

for i in range(len(c)):
    if c[i][1] == wkmax:
        print(c[i][0])

n = int(input())
wk = wkmax = 0
si = {}
for i in range(n):
    st = input()
    if st in si:
        si[st] = si[st] + 1
    else:
        si[st] = 1
    wk = si[st]
    wkmax = max(wk,wkmax)

for i,j in si.items():
    if wkmax == j:
        print(i)

n = int(input())
wk = wkmax = 0
si = {}
for i in range(n):
    st = input()
    if st in si:
        si[st] = si[st] + 1
    else:
        si[st] = 1
    wk = si[st]
    wkmax = max(wk,wkmax)
sl = sorted(si.items())
for i in range(len(sl)):
    if wkmax == sl[i][1]:
        print(sl[i][0])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
l = c.most_common()
n, m = l[0]
for i, j in l:
    if j == m:
        print(i)
           


import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
l = c.most_common()
n, m = l[0]
ans = []
for i, j in l:
    if j == m:
        ans.append(i)
print(ans.sort())


import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
l = c.most_common()
n, m = l[0]
ans = []
for i, j in l:
    if j == m:
        ans.append(i)
for a in sorted(ans):
    print(a)
    


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
S = [input() for _ in range(n)]
d = {}
m = 0
for s in S:
    if s in d:
        d[s] += 1
        m = max(m, d[s])
    else:
        d[s] = 1
        m = 1
sd = sorted(d.items(), key=lambda x: x[1], reverse=True)
for k, v in sd:
    if v != m:
        break
    print(k)


n = int(input())
S = [input() for _ in range(n)]
d = {}
m = 0
for s in S:
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
    m = max(m, d[s])

sd = sorted(d.items(), key=lambda x: x[1], reverse=True)
ans = []
for k, v in sd:
    if v != m:
        break
    ans.append(k)

for a in sorted(ans):
    print(a)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#!python3.4
# -*- coding: utf-8 -*-
# abc155/abc155_c
import sys
import collections

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    c = collections.Counter()
    for _ in range(N):
        c[i2s()] += 1
    most_commons = c.most_common()
    most = most_commons[0][1]
    for mc in most_commons:
        if mc[1] != most:
            break
        print(mc[0])
    return

main()


#!python3.4
# -*- coding: utf-8 -*-
# abc155/abc155_c
import sys
import collections

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    c = collections.Counter()
    most_n = 0
    most_s = []
    for _ in range(N):
        s = i2s()
        c[s] += 1
        if c[s] == most_n:
            most_s.append(s)
        elif c[s] > most_n:
            most_s = [s]
            most_n = c[s]
        # print(most_s)
    for ms in sorted(most_s):
        print(ms)
    return

main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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])


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]
keys.sort()
for i in range(len(keys)):
    print(keys[i])


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

ss = sorted(list(set(s)))
lens = len(ss)
l = [0]*len(ss)
for i in range(lens):
    l[i] =s.count(ss[i])
for i in range(lens):
    if l[i] == max(l):
        print(ss[i])

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.values())
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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]


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 =[w for w,r in c.most_common() if r==aa]
a2=list(sorted(a2))
a3=[print(w1) for w1 in a2]

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())

data = {}
names = []
for i in range(n):
    s = input()
    if s in names:
        data[s] += 1
    else:
        data[s] = 1
        names.append(s)

max_poll = 0
winner = []
for key, value in data.items():
    if max_poll < value:
        max_poll = value
        winner = [key]
    elif max_poll == value:
        winner.append(key)

sorted(winner)
#winner.reverse()
for i in winner:
    print(i)


n = int(input())
data = {}
max_poll = 1

for i in range(n):
    s = input()
    try:
        data[s] += 1
    except:
        data[s] = 1
    if max_poll < data[s]:
        max_poll = data[s]

winner = []
for key, value in data.items():
    if max_poll == value:
        winner.append(key)

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):

from collections import Counter


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

C=Counter(S).most_common()
L=len(C)

print(C[0][0])

for i in range(1,L):
    if C[0][1]==C[i][1]:
        print(C[i][0])


from collections import Counter


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

C=Counter(S).most_common()
L=len(C)

D=[]

D.append(C[0][0])

for i in range(1,L):
    if C[0][1]==C[i][1]:
        D.append(C[i][0])
D.sort()
M=len(D)

for i in range(M):
    print(D[i])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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())

from collections import defaultdict
from operator import itemgetter

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

li = sorted(d.items())
l = sorted(li, key = itemgetter(0), reverse=True)
max_key = l[0][0]

for k, v in li:
    if k == max_key:
        print(k)
    else:
        continue

from collections import defaultdict

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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])

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())
for i in range(len(dictA)):
  if sDict[i][1]== mid:
    print(sDict[i][0])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter

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


counter = Counter(S)

mostnum = 0
ans = []
for c in counter.most_common():
    if mostnum < c[1]:
        mostnum = c[1]
        ans.append(c[0])
    else:
        break

ans.sort()

for a in ans:
    print(a)

from collections import Counter

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


counter = Counter(S)

mostnum = 0
ans = []
for c in counter.most_common():
    if mostnum <= c[1]:
        mostnum = c[1]
        ans.append(c[0])
    else:
        break

ans.sort()

for a in ans:
    print(a)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):

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


from collections import Counter
kazu_word = Counter(word)


kazu_word_a = max(kazu_word.values()) 
kazu_word_max =[i for i,v in kazu_word.items() if v == kazu_word_a )]



print("\n".join(kazu_word_max.sort())) 


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


from collections import Counter
kazu_word = Counter(word)


kazu_word_a = max(kazu_word.values()) 
kazu_word_max =[i for i,v in kazu_word.items() if v == kazu_word_a ]
kazu_word_max_sorted = sorted(kazu_word_max)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import collections
n=int(input())
li=[]
for i in range(n):
    s=str(input())
    li.append(s)
li.sort(reverse=True)
c=collections.Counter(li)
x=len(c)
ans=[]
for i in range(x):
    if c.most_common(x)[i][1]==c.most_common(x)[0][1]:
        ans.append(c.most_common(x)[i][0])
    else:
        break
for j in range(len(ans)):
  print(ans[j])
        
    
    



    

import collections
n=int(input())
li=[]
for i in range(n):
    s=str(input())
    li.append(s)
li.sort(reverse=True)
c=collections.Counter(li)
print(c.most_common()[0][0])
for i in range(1,n):
    if c.most_common()[i][1]==c.most_common()[0][1]:
        print(c.most_common()[i][0])
    else:
        break
        
    
    



    

import collections
n=int(input())
li=[input() for _ in range(n)]
c=collections.Counter(li)
M=max(c.values())
ans=[]
for k,v in c.items():
    if v==M:
      ans.append(k)
ans.sort()
for i in range(len(ans)):
  print(ans[i])
    



    

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter


N=int(input())
l=['']*N
for i in range(N):
    l[i]=input()

l.sort()

print(l)
c=1
c_crt=1
pre=""
ans=[]
for e in l+[""]:
    if e == pre:
        c_crt+=1
    else:
        if c_crt > c:
            ans=[pre]
            c=c_crt
        elif c_crt == c:
            ans.append(pre)
        c_crt=1
    pre=e
for e in ans:
    print(e)

from collections import Counter

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

c = Counter(l)
print(c)

from collections import Counter


N=int(input())
l=['']*N
for i in range(N):
    l[i]=input()

l.sort()

c=1
c_crt=1
pre=""
ans=[]
for e in l+[""]:
    if e == pre:
        c_crt+=1
    else:
        if c_crt > c:
            ans=[pre]
            c=c_crt
        elif c_crt == c:
            ans.append(pre)
        c_crt=1
    pre=e
for e in ans:
    print(e)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter
n = int(input())
dic = {}
b = []
for i in range(n):
    a = input()
    b.append(a)
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
M = max(dic.values())
for j, k in sorted(dic.items):
    if k == M:
        print(j)



n = int(input())
dic = {}
b = []
for i in range(n):
    a = input()
    b.append(a)
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
M = max(dic.values())
for j,k in sorted(dic.items()):
    if k == M:
        print(j)


from collections import Counter
n = int(input())
dic = {}
b = []
for i in range(n):
    a = input()
    b.append(a)
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

for j, k in sorted(dic.items):
    if k == max(dic):
        print(j)



n = int(input())
dic = {}
b = []
for i in range(n):
    a = input()
    b.append(a)
for o in b:
    if o in dic:
        dic[o] += 1
    else:
        dic[o] = 1
M = max(dic.values())
for j,k in sorted(dic.items()):
    if k == M:
        print(j)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter
n=int(input())
name=[input() for _ in range(n)]

cnt=Counter(name)
l=max(cnt.values())
ans=[s for s,c in cnt.items() if c==1]
ans.sort()
print('\n'.join(ans))

from collections import Counter
 
n = int(input())
sss = [input() for _ in range(n)]
cnt = Counter(sss)
l = max(cnt.values())
ans = [s for s, c in cnt.items() if c == l]
ans.sort()
print('\n'.join(ans))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

d = {}

for item in s:
    if item in d.keys():
        d[item] += 1
    else:
        d[item] = 1

start = time.time()
m = [k for k, v in d.items() if v == max(d.values())]
m.sort()
for item in m:
    print(item)


from collections import Counter
import itertools

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

cnt_words = Counter(s)

mode_v = cnt_words.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, cnt_words.most_common()
)
m = []
for i in it:
    m.append(i[0])
m.sort()
for item in m:
    print(item)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#155c
import collections
n = int(input())
s = [input() for _ in range(n)]

c = collections.Counter(s)
ret = []
tmp = []
current_v = 0

for k, v in c.most_common():
  if current_v != v:
    current_v = v
    if tmp != []:
      ret.extend(sorted(tmp))
      break
  tmp.append(k)

print(ret)

#155c
import collections
n = int(input())
s = [input() for _ in range(n)]

c = collections.Counter(s)
ret = []
tmp = []
max_v = max(c.values())

for k, v in c.most_common():
  if max_v == v:
    ret.append(k)
  else:
    break

for r in sorted(ret):
  print(r)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a=int(input())
s=[input()for _ in range(a)]
c=Counter(s)
m=0 
m=max(m,v)
ans=[]
for k,v in c.items():
    if m == v:
        ans.append(k)
ans.sort()
print(ans)


import collections
a=int(input())
s=[input()for _ in range(a)]
c=collections.Counter(s)
m=0 
for v in c.values(): 
    m=max(m,v)
ans=[]
for k,v in c.items():
    if m == v:
        ans.append(k)
ans.sort()
for i in ans:
    print(i)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
s=sorted([input() for k in range(n)])
s3 = sorted(list(set(s)))
if(len(set(s))==len(s)):
    for u in range(len(s)):
        print(s[u])
    exit()
else:
    s1=s2 = [m for m in s3 if s.count(m)>1]
    i = (len(s)-len(s1))//len(s3)                                                                         while(len(s2)!=0):
        s2 = [m for m in s3 if s.count(m)>i]
        if(len(s2)==0):
               break
        s1 = s2
        i+=1
for j in s1:
    print(j)

import collections
n=int(input())
s=[input() for k in range(n)]
if(len(set(s))==len(s)):
    for u in range(len(s)):
        print(s[u])
    exit()
else:
    s1=[q for q in sorted(list(set(s))) if s.count(q) > 1]
c=collections.Counter(s)
p=[]                                                                                                  for i in s1:
    p.append(c[i])
max=max(p)
print(max)
for j, x in enumerate(p):
    if(x == max):
        print(s1[j])

n=int(input())
a={}
for _ in range(n):
    s=input()
    if(s in a):
        a[s]+=1
    else:
        a[s]=1
a=sorted(a.items(),key=lambda x:x[1],reverse=True)
b=[]
b.append(a[0][0])
for j in a[1:]:
    if(j[1]==a[0][1]):
        b.append(j[0])
    else:
        break
for t in sorted(b):
    print(t)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    N = int(input())
    S = [input() for _ in range(N)]#list()

    
    #    S.append(input())
    


#    c = 0
    target = {}

    for word in S:
        if word in target:
            target[word] += 1
        else:
            target[word] = 1

#        c = S.count(i)
#        target[i] = c

    maximum = max(target.values())

    #for val in target.values():
    #    if max < val:
    #        max = val

    for key,val in target.items():
        if(val == maximum):
            print(key)

if __name__ == '__main__':
    main()

def main():
    N = int(input())
    S = [input() for _ in range(N)]#list()

    
    #    S.append(input())
    


#    c = 0
    target = {}

    for word in S:
        if word in target:
            target[word] += 1
        else:
            target[word] = 1

#        c = S.count(i)
#        target[i] = c

    maximum = max(target.values())

    for key,val in sorted(target.items()):
        if(val == maximum):
            print(key)

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
box={}
for i in range(n):
  vote=input()
  if not(vote in box):
    box[vote]=1
  else:
    box[vote]+=1
m=0
win=[]
for num in box.values():
  if num > m:
    m=num
for name,num in box.items():
  if num==m:
    win.append(name)
sorted(win)
for i in win:
  print(i)

n=int(input())
box={}
for i in range(n):
  vote=input()
  if not(vote in box):
    box[vote]=1
  else:
    box[vote]+=1
m=0
win=[]
for num in box.values():
  if num > m:
    m=num
for name,num in box.items():
  if num==m:
    win.append(name)
win=sorted(win)
for i in win:
  print(i)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
L = sorted(input() for _ in range(n))
s = list(set(L))
c = [0] * len(s)
for i in range(len(s)):
    c[i] = L.count(s[i])
m = max(c)
for j in range(len(c)):
    if c[j] == m:
        print(s[j])

n = int(input())
L = sorted(input() for _ in range(n))
s = list(set(L))
c = [0] * len(s)
m = 0
for i in range(len(s)):
    c[i] = L.count(s[i])
    m = max(m, c[i])
for j in range(len(c)):
    if c[j] == m:
        print(s[j])


n = int(input())
L = sorted(input() for _ in range(n))
s = sorted(set(L))
c = [0] * len(s)
prev = 0
cnt = 1
l = 0
for i in range(len(L)):
    if L[i] == prev:
        cnt += 1
    else:
        c[l] = cnt
        l += 1
        cnt = 1
m = max(c)
for j in range(len(c)):
    if c[j] == m:
        print(s[j])

n = int(input())
d = {}
for _ in range(n):
    s = str(input())
    d[s] = 1 if s not in d else d[s] + 1
M = max(d.values())
L = [k for k, v in d.items() if v == M]
L.sort()
for x in L:
    print(x)


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
import statistics
import collections
a=int(input())
#b,c=int(input()),int(input())
# c=[]

#     c.append(i)
#e1,e2 = map(int,input().split())
# f = list(map(int,input().split()))
g = [input() for _ in range(a)]
# h = []

#     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)


import math
import statistics
import collections
a=int(input())
#b,c=int(input()),int(input())
# c=[]

#     c.append(i)
#e1,e2 = map(int,input().split())
# f = list(map(int,input().split()))
g = [input() for _ in range(a)]
# h = []

#     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)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())

dic = {}
for _ in range(n):

    s =input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s]=1

maxdic = max(dic.values())

ans = [i for i in dic if dic[i]==maxdic]
print('\n'.join(ans))

n = int(input())

dic = {}
for _ in range(n):

    s =input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s]=1

maxdic = max(dic.values())

ans = [i for i in dic if dic[i]==maxdic]
print('\n'.join(sorted(ans)))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
s = []
for _ in range(n):
    s.append(input())
d = {}
name = set(s)
for a in name:
    d.update({a:0})
for x in s:
    d[x] += 1
ds = sorted(d.items(), key=lambda x:x[1])
max = ds[-1][1]
ans = []
print(max)
for x in reversed(ds):
    print(x[1])
    if x[1]==max:
        ans.append(x[0])
    else:
        break
ans.sort()
for x in ans:
    print(x)

n = int(input())
s = []
for _ in range(n):
    s.append(input())
d = {}
name = set(s)
for a in name:
    d.update({a:0})
for x in s:
    d[x] += 1
ds = sorted(d.items(), key=lambda x:x[1])
max = ds[-1][1]
ans = []
for x in reversed(ds):
    if x[1]==max:
        ans.append(x[0])
    else:
        break
ans.sort()
for x in ans:
    print(x)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
l=[]
for i in range(n):
    l.append(input())
from collections import Counter
S=Counter(l)

for letter, count in sorted(S.most_common()):
    print(letter)



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

mn = max(S.values())
for letter, count in sorted(S.most_common()):
    if(count==mn):
        print(letter)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = input()
n = int(n)
# strs= input().split()
hashs = {}

for i in range(n):
    s = input()
    if s not in hashs.keys():
        hashs[s] = 1
    else:
        hashs[s] += 1

maxs = 0
for key, value in hashs.items():
    maxs = max(maxs, value)

for key, value in hashs.items():
    if value == maxs:
        print(key)

n = input()
n = int(n)
# strs= input().split()
hashs = {}

for i in range(n):
    s = input()
    if s not in hashs.keys():
        hashs[s] = 1
    else:
        hashs[s] += 1

maxs = 0
for key, value in hashs.items():
    maxs = max(maxs, value)

for key, value in hashs.items():
    if value == maxs:
        print(key)

n = input()
n = int(n)
# strs= input().split()
hashs = {}

for i in range(n):
    s = input()
    if s not in hashs.keys():
        hashs[s] = 1
    else:
        hashs[s] += 1

maxs = 0
for key, value in hashs.items():
    maxs = max(maxs, value)

res = []
for key, value in hashs.items():
    if value == maxs:
        res.append(key)
res.sort()
for m in range(len(res)):
    print(res[m])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
num_list = []
for i in range(n):
    num_list.append(input())

from collections import Counter
checked =  Counter(num_list)
before_count = 0
check_count = 0

for keyword, count in sorted(checked.items(), key=lambda x: -x[1]):
    # print(keyword, count)
    if check_count == 0:
        check_count += 1
        print(keyword)
        before_count = count
    else:
        if count != before_count:
            exit()
        else:
            check_count += 1
            print(keyword)
            before_count = count


n = int(input())
num_list = []
for i in range(n):
    num_list.append(input())

from collections import Counter
checked =  Counter(num_list)
before_count = 0
check_count = 0
result = []
for keyword, count in sorted(checked.items(), key=lambda x: -x[1]):
    if check_count == 0:
        check_count += 1
        result.append(keyword)
        before_count = count
    else:
        if count != before_count:
            break
        else:
            check_count += 1
            result.append(keyword)
            before_count = count

for st in sorted(result):
    print(st)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = input()
N = int(N)
S = {}
for n in range(N):
  word = input()
  if word in S.keys():
    S[word] += 1
  else:
    S[word] = 1
max_value = max(S.values())
for word in S.keys():
  if S[word] == max_value:
    print(word)


N = input()
N = int(N)
S = {}
for n in range(N):
  word = input()
  if word in S.keys():
    S[word] += 1
  else:
    S[word] = 1
max_value = max(S.values())
keys = sorted(list(S.keys()))
for word in keys:
  if S[word] == max_value:
    print(word)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# input1 = list(map(int, (input().split())))
# input2 = list(map(int, (input().split())))
N = int(input())
input2 = []
for i in range(N):
    input2.append(input())

jisyo = {}

for a in input2:
    if a not in jisyo:
        jisyo[a] = 1
    else:
        jisyo[a] += 1

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

m = 10000000000000000

for r in result:
    print(r[0])
    if r[1] < m:
        m = r[1]
    exit(0)


# input1 = list(map(int, (input().split())))
# input2 = list(map(int, (input().split())))
N = int(input())
input2 = []
for i in range(N):
    input2.append(input())

jisyo = {}

for a in input2:
    if a not in jisyo:
        jisyo[a] = 1
    else:
        jisyo[a] += 1

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

m = result[0][1]
for r in result:
    if m != r[1]:
        exit(0)
    print(r[0])


# input1 = list(map(int, (input().split())))
# input2 = list(map(int, (input().split())))
N = int(input())
input2 = []
for i in range(N):
    input2.append(input())

jisyo = {}

for a in input2:
    if a not in jisyo:
        jisyo[a] = 1
    else:
        jisyo[a] += 1

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

m = result[0][1]
liststr = []
for r in result:
    if m != r[1]:
        break
    liststr.append(r[0])

liststr.sort()

for a in liststr:
    print(a)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#

#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    dic = {}
    for i in range(n):
        s = input()
        if s in dic:
            dic[s] += 1
        else:
            dic[s] = 1
    max_ = max(dic.values())
    for k,v in dic.items():
        if v == max_:
            print(k)
if __name__ == '__main__':
  main()


#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#

#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    dic = {}
    for i in range(n):
        s = input()
        if s in dic:
            dic[s] += 1
        else:
            dic[s] = 1
    max_ = max(dic.values())
    L = []
    for k,v in dic.items():
        if v == max_:
            L.append(k)
    L = sorted(L)
    print(*L,sep='\n')
if __name__ == '__main__':
  main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
dic={}
max1=0
ans=[]
n=int(input())
for i in range(n):
    word=input()
    if word in dic:
        dic[word]+=1
    else:
        dic[word]=1

for k in dic.values():
    if k>max1:
        max1=k
print(max1)

for n,b in dic.items():
    print(n,b)
    if b==max1:
        ans.append(n)
sorted(ans)

for i in ans:
    print(i)

dic={}
max1=0
ans=[]
n=int(input())
for i in range(n):
    word=input()
    if word in dic:
        dic[word]+=1
    else:
        dic[word]=1

for k in dic.values():
    if k>max1:
        max1=k
print(max1)

for n,b in dic.items():
    print(n,b)
    if b==max1:
        ans.append(n)
print(ans)


dic={}
max1=0
ans=[]
n=int(input())
for i in range(n):
    word=input()
    if word in dic:
        dic[word]+=1
    else:
        dic[word]=1

for k in dic.values():
    if k>max1:
        max1=k
print(max1)

for n,b in dic.items():
    print(n,b)
    if b==max1:
        ans.append(n)
print(sorted(ans))


dic={}
max1=0
ans=[]
n=int(input())
for i in range(n):
    word=input()
    if word in dic:
        dic[word]+=1
    else:
        dic[word]=1

for k in dic.values():
    if k>max1:
        max1=k

for n,b in dic.items():
    if b==max1:
        ans.append(n)


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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())

strList = list([])

for i in range(N):
  strList.append(str(input()))

strDict = {}

for item in strList:
  if item not in strDict.keys():
    strDict[item] = 1
  else:
    strDict[item] += 1

maxList = list([])

for strKeys in strDict.keys():
  if strDict[strKeys] == max(strDict.values()):
    maxList.append(strKeys)

print(sorted(maxList))

N = input()

strList = list([])

for i in range(N):
  strList.append(str(input()))

strDict = {}

for item in strList:
  if item not in strDict.keys():
    strDict[item] = 1
  else:
    strDict[item] += 1

maxList = list([])

for strKeys in strDict.keys():
  if strDict[strKeys] == max(strDict.items()):
    maxList.append(strKeys)

print(maxList.sort())

N = int(input())

strList = list([])

for i in range(N):
  strList.append(str(input()))

strDict = {}

for item in strList:
  if item not in strDict.keys():
    strDict[item] = 1
  else:
    strDict[item] += 1

maxList = list([])
maxNum = max(strDict.values())

for strKeys in strDict.keys():
  if strDict[strKeys] == maxNum:
    maxList.append(strKeys)

for srtedItem in sorted(maxList):
  print(srtedItem)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
w = {}
for _ in range(n):
    w[i] = w.get(input(), 0) + 1
ans = sorted(i for i, j in w.items() if j == max(w.values()))
for i in ans:
    print(i)


n = int(input())
w = {}
for _ in range(n):
  	s = input()
    w[s] = w.get(s, 0) + 1
ans = sorted(i for i, j in w.items() if j == max(w.values()))
for i in ans:
    print(i)


n = int(input())
s = list(input() for _ in range(n))
s.sort()
now = s[0]
ans = [s[0],]
cnt = 0
m_cnt = 0

for i in range(n):
    word = s[i]
    if word == now:
        cnt +=1
        if cnt > m_cnt:
            ans = [word,]
            m_cnt = cnt
        elif cnt == m_cnt:
            ans.append(word)
    else:
        cnt = 1
        now = word
        if cnt > m_cnt:
            ans = [word,]
            m_cnt = cnt
        elif cnt == m_cnt:
            ans.append(word)

for k in sorted(ans):
    print(k)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
poll={}
m=0
for v in range(n):
    s=input()
    if s in poll:
        poll[s]+=1
        if poll[s]>m:
            m=poll[s]
    else:
        poll[s]=0
for s in poll:
    if poll[s]==m:
        print(s)
    


n=int(input())
poll={}
m=0
rtn=[]
for v in range(n):
    s=input()
    if s in poll:
        poll[s]+=1
        if poll[s]>m:
            m=poll[s]
    else:
        poll[s]=0
for s in poll:
    if poll[s]==m:
        rtn.append(s)
rtn.sort()
for x in rtn:
    print(x)
        
    


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())
s=[input() for i in range (N)]

for q in range N:
  for i in range N-1:
    if s[i]>s[i+1]:
      s0=s[i]
      s[i]=s[i+1]
      s[i+1]=s0

count=1
maximum=0

for j in range N-1:
  if s[j]=s[j+1]:
    count+=1
  else:
    if count>maximum:
      a=[]
      a.append(s[j])
      maximum=count
      number=1
    elif count=maximum:
      a.append(s[j])
      number+=1
    count=0
    
for p in range number:
  print(a[p])

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

for q in range N:
  for i in range N-1:
    if s[i]>s[i+1]:
      s0=s[i]
      s[i]=s[i+1]
      s[i+1]=s0

count=1
maximum=0

for j in range N-1:
  if s[j]=s[j+1]:
    count+=1
  else:
    if count>maximum:
      a=[]
      a.append(s[j])
      maximum=count
      number=1
    elif count=maximum:
      a.append(s[j])
      number+=1
    count=0
    
for p in range number:
  print(a[p])

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

s.sort()
count=1
maximum=0

for j in range (N-1):
  if s[j]==s[j+1]:
    count+=1
    if j==N-2:
      if count>maximum:
        a=[]
        a.clear()
        a.append(s[j])
        maximum=count
        number=1
      elif count==maximum:
        a.append(s[j])
        number+=1
  else:
    if count>maximum:
      a=[]
      a.clear()
      a.append(s[j])
      maximum=count
      number=1
    elif count==maximum:
      a.append(s[j])
      number+=1
    count=1   
  if maximum==1 and j==N-2:
    a.append(s[N-1])
    number+=1
for p in range (number):
  print(a[p])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import collections
N = int(input())
S = [str(input()) for _ in range(N)]

c = collections.Counter(sorted(S))
keys = [k for k, v in c.items() if v == c.most_common()[0][1]]
print(*keys)


N = int(input())
S = {}
for i in range(N):
    tmp = input()
    if tmp in S:
        S[tmp] += 1
    else:
        S[tmp] = 1

most_com = max(S.values())
keys = [k for k,v in S.items() if v == most_com]
keys.sort()

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

dicts = sorted(dicts.items(), key=lambda x:x[1])
max_list = []

buf = dicts[1][1]
for k, v in dicts:
    if v == buf:
        max_list.append(k)
    else:
        break

for k in max_list:
    print(k)

N = int(input())

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

max_list = [kv[0] for kv in d.items() if kv[1] == max(dicts.values())]

print(sorted(max_list))

N = int(input())

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

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

buf = dicts[0][1]
for k, v in dicts:
    if v == buf:
        max_list.append(k)
    else:
        break

for k in sorted(max_list):
    print(k)

Verdicts: Runtime Error

Runtime Error

Accepted