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())
A = [str(input()) for i in range(N)]
A.sort()
B = list(set(A))
ans = [0 for _ in range(len(B))]
for i in range(len(B)):
  ans[i] = A.count(B[i])
i_max = [i for i, x in enumerate(ans) if(max(ans)==x)]

for i in range(len(i_max)):
  print(B[i_max[i]])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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

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

Submission status: Wrong Answer

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
#s = {s():0 for _ in range(n)}

a = {}
for i in range(n):
	s = input()
	try:
		a[s] += 1
	except KeyError:
		a[s] = 1
b = sorted(a.items(),key = lambda x:x[0])

memo = max(b)[1]
for i in b:
	"""print(i,"i")
	print(i[0],"i[0]")
	print(i[1],"i[1]")
	print(max(b)[0],"max(b)[0]")"""
	if i[1] == memo:
		print(i[0])

Submission status: Wrong Answer

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
#s = {s():0 for _ in range(n)}

a = {}
for i in range(n):
	s = input()
	try:
		a[s] += 1
	except KeyError:
		a[s] = 1
b = sorted(a.items(),key = lambda x:x[0])
print(a)
memo = max(b)[1]
for i in b:
	"""print(i,"i")
	print(i[0],"i[0]")
	print(i[1],"i[1]")
	print(max(b)[0],"max(b)[0]")"""
	if i[1] == memo:
		print(i[0])

Submission status: Wrong Answer

Solution code:
from collections import Counter

def main():
    n = int(input())
    s = [input() for _ in range(n)]
    c = Counter(s)
    l = []
    max = -1
    for k, num in c.most_common():
        if num >= max:
            max = num
            l.append(k)
    [print(i) for i in l[::-1]]


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

def main():
    n = int(input())
    s = [input() for _ in range(n)]
    c = Counter(s)
    l = []
    max = 0
    for k, num in c.most_common():
        if num >= max:
            max = num
            l.append(k)
    [print(i) for i in l[::-1]]


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

def main():
    n = int(input())
    s = [input() for _ in range(n)]
    c = Counter(s)
    l = []
    max = 0
    for k, n in c.most_common():
        if n >= max:
            max = n
            l.append(k)
    l = l[::-1]
    [print(i) for i in l]



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

def main():
    n = int(input())
    s = [input() for _ in range(n)]
    c = Counter(s)
    l = []
    max = 0
    for k, n in c.most_common():
        if n >= max:
            max = n
            l.append(k)
    l = l[::-1]
    [print(i) for i in l]

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)
for k, v in b.items():
    if v == max(b.values()):
        print(k)

Submission status: Wrong Answer

Solution code:
# -*- 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 input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


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

"""

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc155/tasks/abc155_c

def main():
    N = int(input())
    S_list = []
    for _ in range(N):
        S_list.append(input())

    S_dict = {}
    for s in S_list:
        S_dict[s]=0
    for s in S_list:
        S_dict[s]+=1

    max_kv = max(S_dict.values())

    max_k_list = [kv[0] for kv in S_dict.items() if kv[1] == max_kv]
    max_k_list.sort()
    for k in max_k_list:
        print(k)

if __name__ == main:
     main()

Submission status: Wrong Answer

Solution code:


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



names = [0]*len(Sset)

for i, name in enumerate(Sset):
    cnt = 0
    for s in S:
        if(name==s):
            cnt += 1
            names[i] = (name, cnt)
max = 0
for n in names:
    if max<n[1]:
        max = n[1]

for n in names:
    if n[1]==max:
        print(n[0])

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = [input() for i in range(n)]
cnt = collections.Counter(s)
largest= max(list(cnt.values()))

for k in cnt.keys():
  if cnt[k] == largest:
    print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
s.sort()
count = 1
ma = 0
for i in range(1,n):
    if s[i] == s[i-1]:
        count+=1
    else:
        ma = max(ma,count)
        count=1
ma = max(ma,count)
count=1
ans = []
for i in range(1,n):
    if s[i] == s[i-1]:
        count+=1
    else:
        if count == ma:
            ans.append(s[i-1])
        count=1
if count == ma:
    ans.append(s[i-1])
for i in ans:
    print(i)

Submission status: Wrong Answer

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

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

maxdic = max(dic.values())

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
import collections
for _ in range(n):
  l.append(str(input()))
c = collections.Counter(l)
m=max(c.items())[1]
x=[]
for i in c:
  if c[i]==m:
    x.append(i)
xy=sorted(x)
for i in xy:
  print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
import collections
for _ in range(n):
  l.append(str(input()))
c = collections.Counter(l)
m=max(c.items())[1]
for i in sorted(c):
  if c[i]==m:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = {}

MAX = 0
for i in range(N):
    s = input()
    A[s] = A.get(s,0) + 1
    MAX = max(MAX, A[s])

B = sorted(A.items())
print(B)
for k, v in B:
    if v == MAX:
        print(k)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = {}

MAX = 0
for i in range(N):
    s = input()
    A[s] = A.get(s,0) + 1
    MAX = max(MAX, A[s])

for k,v in A.items():
  if MAX == v:
    print(k)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
d = Counter(s)
a = 0
for v in d.values():
  if v>a:
    a = v
for k in d.keys():
  if d[k]==a:
    print(k)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

max = s[0][1]
max_s = []

for i in range(len(s)):
    if int(s[i][1]) == int(max):
        max_s.append(s[i][0])
max_s.sort()
print(max_s)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[input() for i in range(n)]
b=list(set(a))
c=[]
d=0
for i in b:
  if a.count(i)>d:
    c=list(i)
    d=a.count(i)
  elif a.count(i)==d:
    c+=list(i)
c.sort()
for i in c:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
dic = {input():0 for i in range(N)}
  
for i in dic:
  dic[i] += 1
  
ans = [] 
for i in dic:
  if dic[i] == max(dic.values()):
    ans.append(i)
ans.sort()
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[12]:


import collections


# In[13]:


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


# In[14]:


mylist = collections.Counter(S).most_common()
cnt_tmp = mylist[0][1]
for word, cnt in mylist:
    if cnt != cnt_tmp:
        break
    print(word)
    cnt_tmp = cnt


# In[ ]:

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value not in S:
        S[value] = 1
    else:
        S[value] += 1
S_largest = max(S.values())
S_sorted = sorted(S.items(),reverse=True)
ans = []
for i in range(len(S_sorted)):
    if S_sorted[i][1] == S_largest:
        ans.append(S_sorted[i][0])
    else:
        break
ans_sorted = sorted(ans)
for a in ans_sorted:
    print(a)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value not in S:
        S[value] = 1
    else:
        S[value] += 1
S_largest = max(S.values())
S_sorted = sorted(S.items(),reverse=True)
print(S_sorted)
ans = []
for i in range(len(S_sorted)):
    if S_sorted[i][1] == S_largest:
        ans.append(S_sorted[i][0])
    else:
        break
ans_sorted = sorted(ans)
for a in ans_sorted:
    print(a)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value in S:
        S[value] += 1
    else:
        S[value] = 1
S_sorted = sorted([k for k, v in S.items() if v == 2])
for ans in S_sorted:
    print(ans)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value in S:
        S[value] += 1
    else:
        S[value] = 1
S_sorted = sorted(S)
for ans in S_sorted:
    print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=dict()
for i in range(n):
    si=input()
    if si in s:
        s[si]+=1
    else:
        s[si]=0
l=max(s.values())
ans=[]
for i in s:
    if s[i]==l:
        ans.append(i)
ans.sort()
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=0
s=[]
for i in range(n):
    si=input()
    s.append(si)
    li=len(si)
    l=max(l,li)
ans=[]
for i in range(n):
    if len(s[i])==l:
        ans.append(s[i])

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

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    S = [str(input()) for _ in range(N)]
    words = dict(zip(set(S), [0] * len(S)))
    for s in S:
        if s in words:
            words[s] += 1

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

    return

resolve()

Submission status: Wrong Answer

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

d = {}
for i in s:
    d.setdefault(i, 0)
    d[i] += 1

maxv = 0
for i in d.values():
    maxv = max(maxv,i)
for i in d.keys():
    if d[i] == maxv:
        print(i)

Submission status: Wrong Answer

Solution code:
#155
def main():
    N = int(input())
    S = [input() for i in range(N)]
    S.sort()
    ans = []
    max_len = 0
    streak = 1
    for i in range(N-1):
        if(S[i]==S[i+1]):
            streak+=1
        else:
            if(streak>max_len):
                max_len = streak
                ans = [S[i]]
            elif(streak==max_len):
                ans.append(S[i])
            streak=1
    if(N==1 or S[-2]!=S[-1]):
        ans.append(S[-1])
    for a in ans:
        print(a)
main()

Submission status: Wrong Answer

Solution code:
#155
def main():
    N = int(input())
    S = [input() for i in range(N)]
    S.sort()
    ans = []
    max_len = 0
    streak = 1
    for i in range(len(S)-1):
        if(S[i]==S[i+1]):
            streak+=1
        else:
            if(streak>max_len):
                max_len = streak
                ans = [S[i]]
            elif(streak==max_len):
                ans.append(S[i])
            streak=1
    for a in ans:
        print(a)
main()

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
Count = [0]*N
 
for T in range(0,N):
    Poll = input()
    if Poll in S:
        Count[S.index(Poll)] += 1
    else:
        S.append(Poll)
        Count[len(S)-1] += 1
 
Count = Count[:len(S)]
MaxIndex = [N for N,V in enumerate(Count) if V==max(Count)]
MaxS = sorted([S[I] for I in MaxIndex])

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}

for i in range(n):
  temp = input()
  try:
    dic[temp] += 1
  except:
    dic[temp] = 0

dic = dict(sorted(dic.items(), key=lambda x: x[0]))

for i in dic.keys():
  print(i)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())

a = Counter([input() for x in range(n)])
a = sorted(a.items(),key=lambda x:x[0])
a = sorted(dict(a).items(),key=lambda x:x[1],reverse=True)
max_num = a[0][1]
i = 0
while a[i][1] == max_num:
    print(a[i][0])
    if len(a)-1 == i:
        break
    i += 1

Submission status: Wrong Answer

Solution code:
class Counter(dict):
  def __missing__(self, i):
    return 0

n = int(input())

s = Counter()

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

s = dict(sorted(s.items(), key=lambda x: -x[1]))
m = list(s.values())[0]

ans = []
for i in s:
  if s[i] == m:
    ans.append(i)


ans.sort()

print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
class Counter(dict):
  def __missing__(self, i):
    return 0

n = int(input())

s = Counter()

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

s = dict(sorted(s.items(), key=lambda x: -x[1]))
m = list(s.values())[0]

ans = []
for i in s:
  if s[i] == m:
    ans.append(i)
  else:
    break

ans.sort()

print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
class Counter(dict):
  def __missing__(self, i):
    return 0

n = int(input())

s = Counter()

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

s = dict(sorted(s.items(), key=lambda x: -x[1]))
m = list(s.values())[0]

ans = []
for i in s:
  if s[i] == m:
    ans.append(i)

ans.sort()

print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
class Counter(dict):
  def __missing__(self, i):
    return 0

n = int(input())

s = Counter()

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

s = dict(sorted(s.items(), key=lambda x: -x[1]))
m = list(s.values())[0]

ans = []
for i in s:
  if s[i] == m:
    ans.append(i)

print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
from collections import Counter
n=int(input())

lst=[input() for _ in range(n)]
p=Counter(lst)
pp=list(Counter(p).values()).count(max(p.values()))
for i in range(pp):
    print(p.most_common()[i][0])

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

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

c=Counter(S)

max_s_list= [kv[0] for kv in c.items() if kv[1]==max(c.values())]

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

Submission status: Wrong Answer

Solution code:
import collections

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

c=collections.Counter(S)

max_s_list= [kv[0] for kv in c.items() if kv[1]==max(c.values())]

for l in max_s_list:
    print(l)

Submission status: Wrong Answer

Solution code:
N=int(input())
Sarr1=[]
Sarr2=[]
for _ in range(N):
    s=input()
    if Sarr1.count(s)==0:
        Sarr1.append(s)
        Sarr2.append(0)
    if Sarr1.count(s)>0:
        i =Sarr1.index(s)
        Sarr2[i]+=1
ans=[]
for i in range(len(Sarr2)):
    if Sarr2[i]==max(Sarr2):
        ans.append(Sarr1[i])
    else:
        pass
FA=sorted(ans)
print(FA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

_Sset1=set(Sarr)
_Sset2=list(_Sset1)
Sset=sorted(_Sset2)

Ssetcount=[]
for i in range(len(Sset)):
    c=Sarr.count(Sset[i])
    Ssetcount.append(c)

maxnum=max(Ssetcount)
ansindex=[]
for j in range(len(Ssetcount)):
    if Ssetcount[j]==maxnum:
        ansindex.append(j)
    else:
        pass
ans=[]
for k in range(len(ansindex)):
    x=Sset[k]
    ans.append(x)

print(ans)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [input() for i in range(N)]
S.sort()
cnt = collections.Counter(S)
oldVal = cnt.most_common()[0][1]

for i in cnt.most_common():
    if oldVal == i[1]:
        print(i[0])
        oldVal = i[1]
    else:
        break

Submission status: Wrong Answer

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

c=collections.Counter(S)
vl=list(c.values())
mv=max(vl)

ans=[]
for k, v in c.items():
  if v==mv:
    ans.append(k)
  else:
    break
ans.sort()
[print(a) for a in ans]

Submission status: Wrong Answer

Solution code:
n=int(input())
a={}
for _ in range(n):
  m=input()
  if m in a:
    a[m]+=1
  else:
    a[m]=1
for k in a.items() :
     if k[1] == max(a.values()):
      print(k[0])

Submission status: Wrong Answer

Solution code:
from collections import Counter

n=int(input())
s=[ input() for i in range(n)]
dick=Counter(s)
dick=dick.most_common()
print(dick)
#print(dick.values())
p=dick[0][1]

s=[]
for k,i in dick:
  if i==p:
    s.append(k)
  else:
    break
ss=sorted(s)
for i in ss:
  print(i)

Submission status: Wrong Answer

Solution code:
N=int(input())
q={}
for i in range(N):
  S=input()
  if S in q:
    q[S]+=1
  else:
    q[S]=1
max_q_list = [kv[0] for kv in q.items() if kv[1] == max(q.values())]    
for i in max_q_list:
  print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
startlist=[]
for _ in range(n):
    startlist.append(input())
dictlist=sorted(startlist)
setlist=list(set(dictlist))
countlist=[0]*(int(len(setlist)))
count=1
count2=1
for i in range(n):
    if i==n-1:
        countlist[i-count2+1]+=count
    elif dictlist[i+1]==dictlist[i]:
        count+=1
        count2+=1
    else:
        countlist[i-count2+1]+=count
        count=1
indexlist=[i for i,x in enumerate(countlist) if x==max(countlist)]
for j in tuple(sorted(indexlist)):
    print(setlist[j])

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for n in range(N):
    A.append(input())
A.sort()
res = A[0]
cnt = 0
B = {}
B[res] = cnt
for n in range(1, N):
    if res == A[n]:
        cnt += 1
    else:
        cnt = 0
    B[A[n]] = cnt
    res = A[n]
res = 0
for key, value in B.items():
    if res < value:
        res = value
for key, value in B.items():
    if res <= value:
        print(key)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
A = []
for n in range(N):
    A.append(input())
A.sort()
A = collections.Counter(A)
res = 0
for k, v in A.items():
    if res < v:
        res = v
for k, v in A.items():
    if res <= v:
        print(k)

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())
for i in range(len(set(s))):
    if c.most_common()[i][1]==c.most_common()[0][1]:
        print(c.most_common()[i][0])

Submission status: Wrong Answer

Solution code:
import collections
import sys

input = sys.stdin.readline
N = int(input())
candidate = [input().strip("\n") for _ in range(N)]

candidate.sort()
c = collections.Counter(candidate)

max = c.most_common()[0][1]

for i in range(len(c.most_common())):
    tmp, tmp2 = c.most_common()[i]
    if tmp2 == max:
        print(tmp)
    else:
        break

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
word_count = defaultdict(int)
for _ in range(N): 
    word_count[input()] += 1
max_amount = sorted(word_count.items(), reverse=True)[0][1]
max_amount_words = sorted([k for k, v in word_count.items() if v == max_amount])
print('\n'.join(max_amount_words))

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(s)
values, counts = zip(*c.most_common())

for i in range(counts.count(max(counts))):
	print(values[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
S=[input() for i in range(N)]
s=Counter(S)
m=max(s.values())
s=sorted(s.items() ,key=lambda s:s[0])

print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input() for i in range(n))
ans = []
s.sort()
b = 0
for i in s:
    a = s.count(i)
    if a > b :
        ans.clear()
        ans.append(i)
    elif a == b:
        ans.append(i)
    b = a
ans = set(ans)
print(*ans, sep = "\n")

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
S=[input() for i in range(N)]
s=Counter(S)
m=max(s.values())
for key,value in s.items():
    if value==m:
        print(key)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

V = []
for i in S:
    V.append(S.count(i))

W= []
for i in range(N):
    if V[i] == max(V):
        W.append(S[i])

W = list(dict.fromkeys(W))

for i in W:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
ans=[]
s=["".join(sorted(input())) for _ in range(n)]
c=collections.Counter(s)
m=max(c.values())
for k,v in c.items():
  if v==m:
    ans.append(k)

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

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
ans=[]
s=["".join(sorted(input())) for _ in range(n)]
c=collections.Counter(s)
m=max(c.values())
for k,v in c.items():
  if v==m:
    ans.append(k)

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = list(input() for _ in range(n))
ls = Counter(s).most_common()
a = []
a.append(ls[0][0])
for i in range(1, len(ls)):
    if ls[i][1] == ls[0][1]:
        a.append(ls[i][0])
for i in a:
    print(i)

Submission status: Wrong Answer

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

from collections import Counter
ls = Counter(S).most_common()
MAX = ls[0][1]

for s,length in ls:
    if MAX == length:
        print(s)
    else:
        exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
word_cnts = {}
ans = []
curr_max = 0
for _ in range(N):
    word = input()
    if word in word_cnts:
        word_cnts[word] += 1
    else:
        word_cnts[word] = 1

    if word_cnts[word] > curr_max:
        curr_max = word_cnts[word]
        ans = [word]
    elif word_cnts[word] == curr_max:
        if word > ans[-1]:
            ans.append(word)
        else:
            ans.insert(0, word)

for word in ans:
    print(word)

Submission status: Wrong Answer

Solution code:
N = int(input())
word_cnts = {}
curr_max = 0
for _ in range(N):
    word = input()
    if word in word_cnts:
        word_cnts[word] += 1
    else:
        word_cnts[word] = 1
    curr_max = max(curr_max, word_cnts[word])

ans = []
for word in word_cnts:
    if word_cnts[word] == curr_max:
        if not ans:
            ans.append(word)
        else:
            if word > ans[-1]:
                ans.append(word)
            else:
                ans.insert(0, word)

for word in ans:
    print(word)

Submission status: Wrong Answer

Solution code:
N=int(input())
s={}
maxs=0
for i in range(N):
  S=input()
  if S not in s:
    s[S]=0
  else:
    s[S]+=1
    maxs=max(maxs,s[S])
s2=sorted(s.items(), key=lambda x:x[0])
ans=[]
for S in s:
  if s[S]==maxs:
    ans.append(S)
for A in ans:
  print(A)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = {}
for i in range(N):
    s = input()
    count.setdefault(s, 0)
    count[s] += 1
p = max(count.values())
for k in count.keys():
    if count[k] == p:
        print(k)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    ss = {}
    max_s = -1
    for _ in range(n):
        s = input()
        if s not in ss:
            ss[s] = 0
        else:
            ss[s] += 1
            max_s = max(max_s, ss[s])

    ss = sorted(ss.items(), key=lambda x: x[0])
    anss = [s for s, i in ss if i == max_s]
    for ans in anss:
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    ss = {}
    max_s = -1
    for _ in range(n):
        s = input()
        if s not in ss:
            ss[s] = 0
        else:
            ss[s] += 1
            max_s = max(max_s, ss[s])

    anss = [s for s in ss if ss[s] == max_s]
    for ans in anss:
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
from collections import defaultdict
d=defaultdict(int)
for _ in range(n):
    d[input()]+=1

L=[(v,k) for (k,v) in d.items()]
L.sort(reverse=True)
max_cnt=L[0][0]
#print('*'*30)
ans=[]
for l in L:
    if l[0]==max_cnt:
        ans.append(l[1])
    else :
        break

for a in ans:
    print(a)

Submission status: Wrong Answer

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

if len(S) == len(set(S)):
  print(sorted(S))
else:
  c = collections.Counter(S)
  ans = sorted([i[0] for i in c.items() if i[1] == c.most_common()[0][1]])
  [print(a) for a in ans]

Submission status: Wrong Answer

Solution code:
a=int(input())
name=[]
cnt=[0]*a
for i in range(a):
    s=input()
    if not s in name:
        name.append(s)
        cnt[i]+=1
    else:
        cnt[name.index(s)] +=1

m=max(cnt)

for a,b in zip(cnt,name):
    if a==m:
        print(b)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n = int(input())

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

dict = sorted(d.items(), key=lambda x:x[1], reverse=True)
max_v = max(d.values())

dict_li = []
for a in dict:
    if a[1]==max_v:
        dict_li.append(a[0])
    else:
        exit()

dict_li.sort()
for s in dict_li:
    print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list()
for i in range(N):
    S.append(str(input()))
 
import collections
 
c = collections.Counter(S)
C = list(c.keys())
 
for i in range(0,len(C)):
    print(C[i])

Submission status: Wrong Answer

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

import collections

c = collections.Counter(S)
C = list(c.keys())

print(list(c.keys()))

for i in range(0,len(C)):
    print(C[i])

Submission status: Wrong Answer

Solution code:
n = int(input())

x = {}
a = [0]*n
c = []
ans = []
#a[0] input()
for i in range(0,n):
  tmp = input()
  if(tmp in x):
    valu = x.get(tmp)
    x[tmp] = valu + 1
    #print(x)
  else:
    x[tmp] = 1
    
#s = sorted(x.items(), key=lambda x:x[1])
#s = sorted(x.values())
#print(s)
ma = max(x.values())
#x = list(x)
#print(x[0])
for key, value in x.items():
  #print(key,value)
  if(value == ma):
    print(key)
  
#print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())

x = {}
a = [0]*n
c = []
ans = []
#a[0] input()
for i in range(0,n):
  tmp = input()
  if(tmp in x):
    valu = x.get(tmp)
    x[tmp] = valu + 1
    #print(x)
  else:
    x[tmp] = 1
    
s = sorted(x.items(), key=lambda x:x[1])
#s = sorted(x.values())
#print(s)
ma = max(x.values())
#print(ma)
for i in range(0,len(s)):
  #print(s[i])
  if(s[i][1] == ma):
    print(s[i][0])
  
#print(s)

Submission status: Wrong Answer

Solution code:
import collections

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

s.sort()
most = collections.Counter(s).most_common()
tmp = most[0][1]

for i in range(len(most)):
    if tmp != most[i][1]:
        exit()
    print(most[i][0])

Submission status: Wrong Answer

Solution code:
import collections

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

s.sort()
most = collections.Counter(s)

most_ans = most.most_common()
most_cnt = most_ans[0][1]
for i in most_ans:
    if most_cnt == i[1]:
        print(i[0])

Submission status: Wrong Answer

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

#重複チェック
c = collections.Counter(S)
value,count = zip(*c.most_common())

s = sorted(value)
ans = []
if len(set(count)) == 1:
    for i in s:
        print(i)
elif len(set(count)) == 2:
    for i in range(len(value)):
        ans.append(value[i])
        if count[i] > count[i+1]:
            [print(i) for i in sorted(ans)]
            exit()
else:
    for i in range(len(value)):
        print(value[i])
        exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[]
a=[]
count=1
ans=1
for i in range(n):
  c=input()
  s.append(c)
s=sorted(s)
print(s)
for i in range(n-1):
  if s[i]==s[i+1]:
    count+=1
  else:
    if ans<count:
      a.clear()
      a.append(s[i])
      ans=count
    elif ans==count:
      a.append(s[i])
    count=1
  
print(a)

Submission status: Wrong Answer

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

#重複チェック
c = collections.Counter(S)
value,count = zip(*c.most_common(len(c)))

if len(set(count)) == 1:
    s = sorted(value)
    for i in s:
        print(i)
else:
    for i in value:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
N=int(input())
li=[]
import collections

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

li.sort()

c=collections.Counter(li)
cl=c.values()
m=max(cl)
keys=[k for k,v in c.items() if v==m]

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