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:
import collections
S = []
N = int(input())
for i in range(N):
    s = input()
    S.append(s)
S = sorted(S)
#print(S)
c = collections.Counter(S)
#print(c)
j = 0

while c.most_common()[j][1]==c.most_common()[0][1] and j<len(collections.Counter(S)):
    if j==len(collections.Counter(S))-1:
        print(c.most_common()[j][0])
        break
    print(c.most_common()[j][0])
    j+=1

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[input() for i in range(n)]
import collections
c=collections.Counter(l)
ll=c.most_common()
tmp=ll[0][1]
ans=[]
for i,j in ll:
    if tmp==j:
        ans.append(i)
    else:
        ans.sort()
        print('\n'.join(map(str,ans)))
        print(1)
        break
ans.sort()
print('\n'.join(map(str,ans)))

Submission status: Wrong Answer

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

T = set(S)
U = list(T)
V = [S.count(U[i]) for i in range(len(T))]

for i in range(len(T)):
    if S.count(U[i]) != max(V):
        U[i] = ''

for i in range(len(T)):
    if U[i] != '':
        print(U[i])

Submission status: Wrong Answer

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

T = set(S)
U = list(T)
V = [S.count(U[i]) for i in range(len(T))]

for i in range(len(T)):
    if S.count(U[i]) != max(V):
        U[i] = ""

for i in range(len(T)):
    print(U[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
s=sorted([input() for i in range(n)])
ct=0
tmp=1
for i in range(n-1):
    if s[i] ==s[i+1]:
        tmp+=1
    else:
        if tmp>ct:
            ct=tmp
        tmp=1
if tmp > ct:
    ct = tmp
    
tmp=1
for i in range(n-1):
    if s[i] ==s[i+1]:
        tmp+=1
        if tmp == ct:
            print(s[i])
    else:
        tmp=1

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for x in range(N):
    S.append(input())
S_label_n = []
S_label = list(set(S))
for x in S_label:
    S_label_n.append(S.count(x))
maxIndex = [i for i, x in enumerate(S_label_n) if x == max(S_label_n)]
ans_list = []
for x in maxIndex:
    ans_list.append(S_label[x])
ans_list.sort()
print(ans_list)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
S_dict = {}
for i in range(N):
    S.append(input())
for i in range(N):
    if(S[i] in S_dict):
        S_dict[S[i]] = S_dict[S[i]]+1
    else:
        S_dict[S[i]] = int(1)
for i in range(len(S_dict)):
    if(S_dict[S[i]]== max(S_dict.values())):
        print(S[i])

Submission status: Wrong Answer

Solution code:
N=int(input())
S={i:input() for i in range(N)}
value=[]
max=0

for i in S.values():
	N=list(S.values()).count(i)
	if N>max or N==max:
		max=N
for j in S.values():
	M=list(S.values()).count(j)
	if N==M:
		value.append(j)
value.sort()
[print(i) for i in value]

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
#辞書順に並べ替え
list_S.sort()
#同じ文字列の回数を調べる
list_a = []
a = 0
while a < N :
    list_a.append(list_S.count(list_S[a]))
    a += list_S.count(list_S[a])
#同じ文字列の回数を大きい順に並べる
newlist_a = sorted(list_a,reverse=True)
#最大回数の個数を調べ、場合分けを行う
n = newlist_a.count(newlist_a[0])
ans = ""
# 最大回数が１個ならば、出力はその回数をインデックスに持つ文字列
if n == 1:
    t = 0
    for i in range(list_a.index(newlist_a[0])):
        t += list_a[i]
    ans = list_S[t+1]
else:
#最大回数が１の場合はすべての文字列が出力される
    if newlist_a[0]==1:
        for i in range(len(list_S)):
            ans += list_S[i]+"\n"
    else:            
# 複数ある最大回数のlist_aにおけるインデックスを調べる
        list_t = []
        for i in range(n):
            m = 0
            for j in range(list_a.index(newlist_a[0],i+1)):       
                m += list_a[j]
            list_t.append(m)
        for i in range(len(list_t)):
            ans += list_S[list_t[i]]+"\n"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
while a < N :
    list_a.append(list_S.count(list_S[a]))
    a += list_S.count(list_S[a])
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
ans = ""
if n == 1:
    t = 0
    for i in range(list_a.index(newlist_a[0])):
        t += list_a[i]
    ans = list_S[t+1]
else:
    if newlist_a[0]==1:
        for i in range(len(list_S)):
            ans += list_S[i]
            ans += "\n"
    else:            
        list_t = []
        for i in range(n):
            b = list_a.index(newlist_a[0],i)
            m = 0
            for j in range(b):
                m += list_a[j]
            list_t.append(m)
        for i in range(len(list_t)):
            ans += list_S[list_t[i]]
            ans += "\n"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a)
        a = 0
list_a.append(a)
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
list_ans = []
if n == 1:
    t = list_a.index(newlist_a[0])
    m = 0
    for i in range(t):
        m += list_a[i]
    list_ans.append(list_S[m+t])
else:
    list_A = []
    for i in range(len(list_a)):
        list_A.append(list_a[i])
    list_t = []
    list_t.append(list_A.index(newlist_a[0]))
    for i in range(newlist_a.count(newlist_a[0])-1):
        list_A.remove(newlist_a[i])
        list_t.append(list_A.index(newlist_a[i])+i+1)
    for i in range(len(list_t)):
        m = 0
        for j in range(list_t[i]):
            m += list_a[j]
        if newlist_a[0]==0:
            list_ans.append(list_S[m])
        else:
            list_ans.append(list_S[m+list_t[i]])
list_ans.sort()
print(list_ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
print(list_S)
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a)
        a = 0
list_a.append(a)
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
list_ans = []
if n == 1:
    t = list_a.index(newlist_a[0])
    m = 0
    for i in range(t):
        m += list_a[i]
    list_ans.append(list_S[m+t])
else:
    list_A = []
    for i in range(len(list_a)):
        list_A.append(list_a[i])
    list_t = []
    list_t.append(list_A.index(newlist_a[0]))
    for i in range(newlist_a.count(newlist_a[0])-1):
        list_A.remove(newlist_a[i])
        list_t.append(list_A.index(newlist_a[i])+i+1)      
    for i in range(len(list_t)):
        m = 0
        for j in range(list_t[i]):
            m += list_a[j]
        if newlist_a[0]==0:
            list_ans.append(list_S[m])
        else:
            list_ans.append(list_S[m+list_t[i]])
list_ans.sort()
print(list_ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a)
        a = 0
list_a.append(a)
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
list_ans = []
if n == 1:
    t = list_a.index(newlist_a[0])
    m = 0
    for i in range(t):
        m += list_a[i]
    list_ans.append(list_S[m+t])
else:
    list_A = []
    for i in range(len(list_a)):
        list_A.append(list_a[i])
    list_t = []
    list_t.append(list_A.index(newlist_a[0]))
    for i in range(newlist_a.count(newlist_a[0])-1):
        list_A.remove(newlist_a[i])
        list_t.append(list_A.index(newlist_a[i])+i+1)
        
    for i in range(len(list_t)):
        m = 0
        for j in range(list_t[i]):
            m += list_a[j]
        if newlist_a[0]==1:
            list_ans.append(list_S[m])
        else:
            list_ans.append(list_S[m+list_t[i]])
list_ans.sort()
print(list_ans)

Submission status: Wrong Answer

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

list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a)
        a = 0
list_a.append(a)

newlist_a = sorted(list_a,reverse=True)

n = newlist_a.count(newlist_a[0])
list_ans = []
if n == 1:
    t = list_a.index(newlist_a[0])
    m = 0
    for i in range(t):
        m += list_a[i]
    list_ans.append(list_S[m+t])
else:
    list_t = []
    list_t.append(list_a.index(newlist_a[0]))
    for i in range(newlist_a.count(newlist_a[0])-1):
        list_a.remove(newlist_a[i])
        list_t.append(list_a.index(newlist_a[i])+1)

    for i in range(len(list_t)):
        m = 0
        for j in range(list_t[i]):
            m += list_a[j]
        list_ans.append(list_S[m+list_t[i]])
list_ans.sort()
print(list_ans)

Submission status: Wrong Answer

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

#　同一文字列の回数を数える
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a)
        a = 0
list_a.append(a)


# 最も回数の多かった文字列の書き出し
newlist_a = sorted(list_a,reverse=True)

n = newlist_a.count(newlist_a[0])
list_ans = []
if n == 1:
# list_aにおける最大回数のインデックスを調べる
    t = list_a.index(newlist_a[0])
# list_aにおけるインデックスtまでの要素の数を調べて再頻出の文字列を書き出す
    m = 0
    for i in range(t):
        m += list_a[i]
    list_ans.append(list_S[m+t])
else:
# list_aにおける最大回数のインデックスを把握
    list_t = []
    list_t.append(list_a.index(newlist_a[0]))
    for i in range(newlist_a.count(newlist_a[0])-1):
        list_a.remove(newlist_a[i])
        list_t.append(list_a.index(newlist_a[i])+1)

    for i in range(len(list_t)):
        m = 0
        for j in range(list_t[i]):
            m += list_a[j]
        list_ans.append(list_S[m+list_t[i]])
list_ans.sort()
print(list_ans)

Submission status: Wrong Answer

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


counter=Counter(S)
L=[]
t=0
for j in range(N):
    value=counter[S[j]]
    if t<value:
        t=value
        L=[]
        L.append(S[j])
    
    elif t==value:
        L.append(S[j])
    
    elif t>value:
        pass

L.sort()

L=list(set(L))

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

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [input() for _ in range(N)]
c = collections.Counter(S)
n = len(c)
max = c.most_common()[0][1]
for j in range(n):
  if c.most_common()[j][1] != max:
    break
ans = [c.most_common()[i][0] for i in range(j)]
ans.sort()
for i in range(j):
  print(ans[i])

Submission status: Wrong Answer

Solution code:
n = int(input())

words = []

for i in range(n):
    words.append(input())

words_s = sorted(list(set(words)))

count = {}

for i in words_s:
    count[i] = words.count(i)

m = max(list(count.values()))

for i in range(len(count)):
    if list(count.values())[i] == m:
        print(list(count.keys())[i])

Submission status: Wrong Answer

Solution code:
from itertools import groupby

n = int(input())

words = []

for i in range(n):
    words.append(input())

words.sort()

count_w = {}

for key, value in groupby(words):
    count_w[key] = len(list(value))

for i in range(len(count_w)):
    key = list(count_w.keys())[i]
    if count_w[key] == max(list(count_w.values())):
        print(key)

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())

words = [stdin.readline().rstrip() for _ in range(n)]

words_s = sorted(list(set(words)))

count = {}

for i in words_s:
    count[i] = words.count(i)

maxIndex = [i for i, x in enumerate(
    count.values()) if x == max(count.values())]

for i in maxIndex:
    print(list(count.keys())[i])

Submission status: Wrong Answer

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

ans = {}
for si in s:
    if si in ans:
        ans[si] = ans[si] + 1
    else:
        ans[si] = 0

max_cnt = ans[max(ans)]

for t in sorted(ans):
    if ans[t] == max_cnt:
        print(t)

Submission status: Wrong Answer

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

ans = {}
for si in s:
    if si in ans:
        ans[si] += 1
    else:
        ans[si] = 0

max_cnt = ans[max(ans)]

"""
ans = [t for t in ans.keys() if ans[t] == max_cnt]
for t in sorted(ans):
    print(t)
"""

for t in sorted(ans):
    if ans[t] == max_cnt:
        print(t)

Submission status: Wrong Answer

Solution code:
k=int(input())
p=[input() for i in range(k)]
m=0
a=[]
for j in frozenset(p):
  if not p.count(j)<m:
    a.append(j)
print("\n".join(sorted(a)))

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [str(input()) for i in range(N)]
new_S = collections.Counter(S)
M = max(new_S.values())
#X = []
for K,V in new_S.items():
  if V == M:
    print(K)

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
List = list()
for _ in range(n):
  List.append(input())
s=collections.Counter(List)
s_inv={v:k for k,v in s.items()}
print(s_inv[max(s.values())])

Submission status: Wrong Answer

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

    #for i in range(N):
    #    S.append(input())
    #    S_uniquie = sorted(set(S))

#    S_uniquie = sorted(set(S))
#    c = 0
    target = {}

    for word in S:
        if word in target:
            target[word] += 1
        else:
            target[word] = 1
#    for i in S_uniquie:
#        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()

Submission status: Wrong Answer

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

    #for i in range(N):
    #    S.append(input())
    #    S_uniquie = sorted(set(S))

    S_uniquie = sorted(set(S))
    c = 0
    target = {}

    for i in S_uniquie:
        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()

Submission status: Wrong Answer

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

    #for i in range(N):
    #    S.append(input())
    #    S_uniquie = sorted(set(S))

    S_uniquie = sorted(set(S))
    c = 0
    target = {}

    for i in S_uniquie:
        c = S.count(i)
        target[i] = c

    max = 0

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
lis=[]
for i in range(n):
  s=str(input())
  if not s in set(l):
    l.append(s)
    lis.append([s,0])
  for i in range(len(l[0])):
    if lis[i][0]==s:
      lis[i][1]+=1
      break
tmp=lis[0][1]
tmpl=[lis[0][0]]
for j in range(1,len(l)):
  if tmp<lis[j][1]:
    tmp=lis[j][1]
    tmpl.clear()
    tmpl.append(lis[j][0])
  elif tmp==l[j][1]:
    tmpl.append(lis[j][0])
tmpl.sort()
for i in range(len(tmpl)):
  print(tmpl[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
d=dict()
for i in range(n):
    s=input()
    if s not in d.keys():
        d[s]=-1
    else:
        d[s]-=1

a=sorted(d.items(),key=lambda x:x[0])
for k,v in a:
    if v!=a[0][1]:
        break
    print(k)

Submission status: Wrong Answer

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

ans = {}
for si in s:
    if si in ans:
        ans[si] += 1
    else:
        ans[si] = 0

max_cnt = ans[max(ans)]


ans = [t for t in ans.keys() if ans[t] == max_cnt]
for t in sorted(ans):
    print(t)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = list()

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

        S_uniquie = sorted(set(S))

    c = 0
    target = {}

    for i in S_uniquie:
        c = S.count(i)
        target[i] = c

    max = 0

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list()

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

S_uniquie = sorted(set(S))

c = 0
target = {}

for i in S_uniquie:
    c = S.count(i)
    target[i] = c

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
for i in range(n):
  s.append(input())
s = sorted(s)
max_count = 1
count = 1
ans = []
for i in range(n-1):
  if s[i] == s[i+1]:
    count += 1
    if count == max_count:
      ans.append(s[i])
    if count > max_count:
      max_count = count
  else:
    count = 1
    if max_count == 1:
      ans.append(s[i])
if max_count == 1:
  ans.append(s[n-1])
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
ans = []
for i in range(n):
  s.append(input())
s = sorted(s)
max_count = 1
count = 1
for i in range(n-1):
  if s[i] == s[i+1]:
    count += 1
    if count == max_count:
      ans.append(s[i])
    if count > max_count:
      max_count = count
      ans = [s[i]]
  else:
    count = 1
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
words = [input() for i in range(n)]
words_set = set(words)
counter = [0 for j in range(int(len(words_set)))]
words_dic = {}

words_list = list(zip(words_set, counter))
words_dic = dict(words_list)

for k in words:
    words_dic[k] = words_dic[k] + 1
fin = [ii[0] for ii in words_dic.items() if ii[1] == max(words_dic.values())]
fin.sort
for jj in fin:
    print(jj)

Submission status: Wrong Answer

Solution code:
def poll(s_list):
  s_dict = {}
  for s in s_list:
    if s not in s_dict:
      s_dict[s] = 1
    else:
      s_dict[s] += 1
#  sorted_dict = sorted(s_dict.items(), key=lambda x:x[1])
  max_val = max(s_dict.values())
  max_key = [key for key in s_dict if s_dict[key] == max_val]
#  new_s_list = sorted(dict(sorted_dict).keys())
  new_s_list = sorted(max_key)
  return new_s_list

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

new_list = poll(s_list)
print(new_list)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	n = INT()
	vote = defaultdict(int)

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

	t_0 = max(vote.values())
	vote_ = sorted(vote.items(), key = lambda x : x[1])
	#print(vote)
	
	for s,t in vote_[::-1]:
		if t == t_0:
			print(s)

if __name__=='__main__':
	main()

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	n = INT()
	vote = defaultdict(int)

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

	t_0 = max(vote.values())
	vote = sorted(vote.items(), key = lambda x : x[1])
	#print(vote)
	
	for s,t in vote[::-1]:
		if t == t_0:
			print(s)

if __name__=='__main__':
	main()

Submission status: Wrong Answer

Solution code:
import collections
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
#     S = sorted(list(map(str, input().split())))
#     a a a b c d d d e f
    c = collections.Counter(S)
    c = c.most_common()
    maxi = c[0][1]
#     print(c[-1])
    ans = []
    for i in c:
        if (i[1]==maxi):
#             print(c[i][0],end="")
            ans.append(i[0])
    ans = '\n'.join(ans)
#     print(ans,end="\n")
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
import collections
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
#     S = sorted(list(map(str, input().split())))
#     a a a b c d d d e f
    c = collections.Counter(S)
    c = c.most_common()
    maxi = c[0][1]
    print(c[-1])
    ans = []
    for i in c:
        if (i[1]==maxi):
#             print(c[i][0],end="")
            ans.append(i[0])
    ans = '\n'.join(ans)
#     print(ans,end="\n")
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
import collections
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
    c = collections.Counter(S)
    c = c.most_common()
    maxi = c[0][1]
    ans = []
    for i in range(len(c)):
        if (c[i][1]==maxi):
#             print(c[i][0],end="")
            ans.append(c[i][0])
#             print
#     ans = '\n'.join(ans)
    print(ans,sep="\n")
main()

Submission status: Wrong Answer

Solution code:
import collections
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
    c = collections.Counter(S)
    c = c.most_common()
    maxi = c[0][1]
#     ans = []
    for i in range(len(c)):
        if (c[i][1]==maxi):
            print(c[i][0],end="")
#             ans.append(c[i][0])
#             print
#     ans = '\n'.join(ans)
#     print(ans)
main()

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s)
m = 0
for v in c.values():
	m = max(m, v)
print(c.items())
ans = []
for k, v in c.items():
	if v == m:
		ans.append(k)
ans.sort()
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
T = {S[0]:1}
for j in range(1,N):
    if S[j] not in T:
        T[S[j]] = 1
    else:
        T[S[j]] += 1
T_sorted = sorted(T.items(),key = lambda x:-x[1])
maxT = T_sorted[0][1]
for k in range(len(T_sorted)):
    if T_sorted[k][1] != maxT:
        break
    print(T_sorted[k][0])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
T = {S[0]:1}
for j in range(1,N):
    if S[j] not in T:
        T[S[j]] = 1
    else:
        T[S[j]] += 1
T_sorted = sorted(T.items(),key = lambda x:-x[1])
maxT = T_sorted[0][1]
print(T_sorted)
for k in range(len(T_sorted)):
    if T_sorted[k][1] != maxT:
        break
    print(T_sorted[k][0])

Submission status: Wrong Answer

Solution code:
import collections
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
    c = collections.Counter(S)
    c = c.most_common()
    maxi = c[0][1]
#     c.most_common()[0][1]
    for i in range(len(c)):
        if (c[i][1]==maxi):
            print(c[i][0])
main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
    D = list(set(S))
    count = [0]*len(D)
    for i in range(len(D)):
        count[i] = S.count(D[i])
    maxi = max(count)
    for i in range(len(D)):
        if(count[i]==maxi):
            print(D[i])
main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
    D = list(set(S))
    count = []
    for i in range(len(D)):
        count.append(S.count(D[i]))
    maxi = max(count)
    for i in range(len(D)):
        if(count[i]==maxi):
            print(D[i])
main()

Submission status: Wrong Answer

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

maxi = 1
count = 1
i = 0
tmp = []
while i<N-1:

    if S_S[i] == S_S[i+1]:
        count = count + 1
        if count > maxi:
            maxi = count
            tmp = []
        i = i + 1
    else:
        count = 1
        i = i + 1
    if maxi == count:
        tmp.append(i)
#print(maxi)
#print(S_S)
for i in range(len(tmp)):
    print(S_S[tmp[i]])

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
s = [input() for i in range(n)]
s.sort()
t = collections.Counter(s)
maxv = max(t.values())
for key,value in t.items():
    if value == maxv:
        print(key)

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
for i in range(n):
  elem = input()
  if not elem in dic:
    dic[elem] = 1
  else:
    dic[elem] += 1
max_ = max(dic.values())

res = []
for k, v in dic.items():
  if v == max_:
    res.append(v)

res = sorted(res)
for elem in res:
  print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
for i in range(n):
  elem = input()
  if not elem in dic:
    dic[elem] = 1
  else:
    dic[elem] += 1
max_ = max(dic.values())

for k, v in dic.items():
  if v == max_:
    print(k)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[input() for i in range(n)]
import collections
c = collections.Counter(l)
#print(c)
e=list(c.most_common())
max_=c.most_common()[0][1]
#print(max_)
d=[]
for i in range(len(e)):
    if e[i][1]!=max_:break
    d.append(e[i][0])
print(*d)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

from collections import Counter

c = Counter(s)
m = max(c.values())
ans = []
for k,v in c.items():
    if v == m:
        ans.append(k)
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

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

values, counts = zip(*c.most_common())

counts = set(counts)
counts = list(counts)
num = counts[-1]


for i in range(num):
  print(string_list[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
str_list = []

for count in range(n):
    str_list.append(input())
set_list = set(str_list)

max = 0
ans = []

for txt in set_list:
    count = str_list.count(txt)
    if(max < count):
        max = count
        ans.clear
        ans.append(txt)
    elif(max == count):
        ans.append(txt)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
str_list = []

for count in range(n):
    str_list.append(input())

list_set = set(str_list)


# print(str_list)
# print(list_set)


# print(str_list)
# str_list = filter(lambda txt: txt != set_txt, str_list)
# print(str_list)
# print('!!!!!')


max = 0
ans = []
for set_txt in list_set:
    count = 0
    for list_txt in str_list:
        if(set_txt == list_txt):
            count += 1
    print(str_list)
    str_list = ([s for s in str_list if s != 'set_txt'])
    if(max < count):
        max = count
        ans.clear
        ans.append(set_txt)
    elif(max == count):
        ans.append(set_txt)
    print(count)

ans.sort()
for txt in ans:
    print('---' + txt)
    # print(txt)

Submission status: Wrong Answer

Solution code:
n = int(input())
str_list = []

for count in range(n):
    str_list.append(input())

list_set = set(str_list)

max = 0
ans = []
for set_txt in list_set:
    count = 0
    for list_txt in str_list:
        if(set_txt == list_txt):
            count += 1
    if(max < count):
        max = count
        ans.clear
        ans.append(set_txt)
    elif(max == count):
        ans.append(set_txt)

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

Submission status: Wrong Answer

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

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
  if order > len(ranking)-1:
    break
for word in sorted(candidates):
  print(word)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[]
for i in range(N):
  a.append(input())
b=list(set(a))
c=list(map(lambda x:a.count(x),b))
d=int(c.count(max(c)))
e=[]
for k in range(d):
  e.append(b[c.index(max(c))])
  c[c.index(max(c))]=0
e.sort()
print(e)