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())
newlist=list()
for i in range(0,n):
  x=str(input())
  newlist.append(x)
newlist.sort()
dic=dict()
for i in newlist:
  x=newlist.count(i)
  dic[x]=list()
maxx=0  
for i in newlist:
  x=newlist.count(i)
  if x>maxx:
    maxx=x
  dic[x].append(i) 


s=set(dic[maxx])

for i in s:
  print(i)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [input() for _ in range(N)]
S.sort()
c = collections.Counter(S)
m = max(c.values())
for k, v in c.items():
    if m == v:
        print(k)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
S = [[0] * 2 * 10 * 5] * n
l = []

for i in range(n):
    S[i] = input()

c = collections.Counter(S)
tmp = c[max(c)]
i = 0
for k,v in c.items():
    if tmp != v:
        if i == 0:
            l.append(k)    
        break
    tmp = v
    i = 1
    l.append(k)



l = sorted(l)
for i in l:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
S = [[0] * 2 * 10 * 5] * n
l = []

for i in range(n):
    S[i] = input()

c = collections.Counter(S)
tmp = c[max(c)]
i = 0
for k,v in c.items():
    if i == 1 and tmp != v:
        break
    tmp = v
    i = 1
    l.append(k)



l = sorted(l)
for i in l:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
S = [[0] * 2 * 10 * 5] * n
l = []

for i in range(n):
    S[i] = input()

c = collections.Counter(S)
tmp = c[max(c)]
l.append(max(c))
flag = 0
for k,v in c.items():
    if flag == 0:
        flag = 1
        continue
    if tmp != v:
        break
    tmp = v
    l.append(k)



l = sorted(l)
for i in l:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
S = [[0] * 2 * 10 * 5] * n
l = []

for i in range(n):
    S[i] = input()

c = collections.Counter(S)
tmp = c[max(c)]

for k,v in c.items():
    l.append(k)
    if tmp != v:
        break
    tmp = v


l = sorted(l)
for i in l:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections
import numpy as np
n = int(input())
S = [[0] * 2 * 10 * 5] * n
l = []

for i in range(n):
    S[i] = input()

c = collections.Counter(S)
tmp = c[max(c)]

for k,v in c.items():
    if tmp != v:
        break
    tmp = v
    l.append(k)

l = sorted(l)
for i in l:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections
import numpy as np
n = int(input())
S = [[0] * 2 * 10 * 5] * n


for i in range(n):
    S[i] = input()

c = collections.Counter(S)
tmp = c[max(c)]
for k,v in c.items():
    if tmp != v:
        break
    tmp = v
    print(k)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[]
for i in range(N):
  a.append(input())
b=list(set(a))
c=[]
for j in range(len(b)):
  c.append(a.count(b[j]))
d=int(c.count(max(c)))
e=[]
for k in range(d):
  e.append(b[c.index(max(c))])
  b.remove(e[k])
for l in range(len(e)):
  print(min(e))
  e.remove(min(e))

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[]
for i in range(N):
  a.append(input())
b=list(set(a))
c=[]
for j in range(len(b)-1):
  if a.count(b[0])>a.count(b[1]):
    b.remove(b[1])
  elif a.count(b[0])==a.count(b[1]):
    c.append(b[0])
    b.remove(b[0])
  else:
    b.remove(b[0])
if len(c)==0:
  c.append(b[0])
if a.count(b[0])==a.count(c[0]):
  c.append(b[0])
d=list(set(c))
for k in range(len(d)):
  print(min(d))
  d.remove(min(d))

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [input() for _ in range(N)]
c = collections.Counter(S)
m = max(c.values())
for k, v in c.items():
    if m == v:
        print(k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for _ in range(n)]
import collections
c = collections.Counter(s)
d = c.most_common()
e = [d[0][0]]
for i in range(len(d)-1): #nじゃない　dの長さ
   if d[0][1] == d[i+1][1]:
      e.append(d[i+1][0])       #辞書順にする
e.sort()
print(repr(e))   #print(repr(e))でもいける？

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
input=sys.stdin.readline
N=int(input())
d=Counter(list(input()[:-1] for _ in range(N)))
d1=dict(sorted(d.items(), key=lambda x:x[1],reverse=True))

L=[]
for k, v in d1.items():
 if v == max(d1.values()):
  L.append(k)
 else:break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for _ in range(n)]
import collections
c = collections.Counter(s)
d = c.most_common()
print(d[0][0])
for i in range(len(d)-1): #nじゃない　dの長さ
   if d[0][1] == d[i+1][1]:
      print(d[i+1][0])

Submission status: Wrong Answer

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

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

ans = 0
for i in d.values():
  if ans < i:
    ans = i

for k, v in d.items():
  if ans == v:
    print(k)

Submission status: Wrong Answer

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

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
    
ans = 0
for i in d:
  if ans < d[i]:
    ans = d[i]

for i in d:
  if ans == d[i]:
    print(i)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[]
for i in range(N):
  a.append(input())
b=list(set(a))
c=[]
for j in range(len(b)-1):
  if a.count(b[0])>a.count(b[1]):
    b.remove(b[1])
  elif a.count(b[0])==a.count(b[1]):
    c.append(b[0])
    b.remove(b[0])
  else:
    b.remove(b[0])
c.append(b[0])
d=[]
for l in range(len(c)):
  d.append(min(c))
  c.remove(d[l])
for m in d:
  print(m)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
S = []
for _ in range(n):
    S.append(input())  # S += [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)

Submission status: Wrong Answer

Solution code:
import collections

def resolve():
    N = int(input())
    S_list = []
    for i in range(N):
        S_list.append(input())
    
    cc = collections.Counter(S_list)
    cc_list = cc.most_common()

    for i in cc_list:
        print(i[0])


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
N = int(input().rstrip())
dict = {}

def in_dict(key):
  if key in dict.keys():
    dict[key] += 1
  else:
    dict[key] = 1
  

for n in range(1,N):
  in_dict(input().rstrip())
  
max_val = max(dict.values())
keys_max = [key for key in dict if dict[key] == max_val]

keys_max = sorted(keys_max)

for res in keys_max:
  print(res)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
listA = []
listB = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
listB.append(c[0][0])
A = len(c)
for i in range(1,A-1):
    if max_number == c[i][1]:
        listB.append(str(c[i][0]))
    else:
        break
listB.sort()
for i in listB:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
listA = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
print(c[0][0])
A = len(c)
for i in range(1,A):
    if max_number == c[i][1]:
        print(c[i][0])
    else:
        exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
MAX = 0
cnt = 0
WORD = []
for i in range(N):
    if i == 0:
        cnt = 1
        MAX = 1
        WORD.append(S[i])
    elif S[i] == S[i-1]:
        cnt+=1
        if cnt == MAX:
            WORD.append(S[i])
        if cnt > MAX:
            MAX = cnt
            WORD.clear()
            WORD.append(S[i])
    else:
        cnt = 1

for ans in WORD:
    print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

s = Counter(S)
print(s)
max_cnt = s.most_common()[0][1]
names = [name for name, cnt in s.items() if cnt == max_cnt]
names.sort()

print("\n".join(names))

Submission status: Wrong Answer

Solution code:
a = int(input())
ar = []
br = {}
cr = []
mx = 0
for i in range(a):
    l = input()
    if l not in ar:
        br[l] = 1
        ar.append(l)
    else:
        br[l] += 1
    if br[l] >= mx:
        mx = br[l]
        cr.append(l)
    elif br[l] > mx:
        mx = br[l]
        cr.clear()
        cr.append(l)
cr.sort()
for r in cr:
    print(r)

Submission status: Wrong Answer

Solution code:
a = int(input())
ar = []
br = {}
cr = []
mx = 0
for i in range(a):
    l = input()
    if l not in ar:
        br[l] = 1
        ar.append(l)
    else:
        br[l] += 1
    if br[l] >= mx:
        mx = br[l]
        cr.append(l)
    elif br[l] > mx:
        cr.clear()
        cr.append(l)
cr.sort()
for r in cr:
    print(r)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
for i in range(n):
    s.append(input())
s.sort()
now = ""
array = []
count = 0
maxcount = 0
print(s)
for i in range(n):
    if now != s[i] or i == n-1:
        if maxcount == count:
            array.append(now) #最大の回数の文字列を挿入
        elif maxcount < count:
            maxcount = count
            array = []
            array.append(now)
        if i == n-1 and maxcount == 1:
            array.append(s[i])
        now = s[i]
        count = 1
    else:
        count += 1
    print(maxcount,count)
for i in range(len(array)):
    print(array[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter

c = Counter(input() for _ in range(int(input())))
print(c)
m = c.most_common(1)[0][1]
print(m)
for s in sorted(s for s, k in c.items() if k == m):
  print(s)

Submission status: Wrong Answer

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

count = collections.Counter(temp)
ll = count.most_common(count.most_common(1)[0][1])
ll.sort()
for i in range(len(ll)):
    print(ll[i][0])

Submission status: Wrong Answer

Solution code:
N = int(input())
s = [input() for i in range(N)]
import collections
s1 = sorted(s)
 
c = collections.Counter(s1)
s2 = c.most_common()
 
#print(s2)
a = 0
for i in range(len(s2)):
    if s2[0][1] == s2[i][1]:
        a = a + 1
s3 = []
 
for i in range(a):
    s3.append(s2[i][0])
for i in range(a):
    print(s3[i])

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
S = [input() for i in range(n)]
c = collections.Counter(S)
li = c.most_common()
M = li[0][1]
for x in li:
    if x[1] == M:
        print(x[0])
    else:
        break

Submission status: Wrong Answer

Solution code:
import collections
from sys import stdin
N = int(stdin.readline().rstrip())
data = []
for i in range(N):
    s = (stdin.readline().rstrip())
    data.append(s)
c = collections.Counter(data)
maxc = max(c.values())
for j in c.keys():
    if c[j] == maxc:
        print(j)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = [input() for i in range(n)]
i = 0
count, yo = [], []

while not(x == []):
  a = x.count(x[i])
  count.append(a)
  yo.append(x[i])
  x.remove(x[i])
  
for k, c in enumerate(count):
  if c == max(count):
    print(yo[k])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input().split()
S_set = set(S)
maxnum = 0
for i in S_set:
    if S.count(i)>maxnum:
        maxnum = S.count(i)

for i in S_set:
    if S.count(i) == maxnum:
        print(i)

Submission status: Wrong Answer

Solution code:
import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
maxv = -1
ans = []
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  ans.append(k)
  maxv = v
for a in sorted(ans, reverse=True):
  print(a)

Submission status: Wrong Answer

Solution code:
import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
maxv = -1
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  print(k)
  maxv = v

Submission status: Wrong Answer

Solution code:
import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
print('\n'.join([ k for k , v in c.most_common()]))

Submission status: Wrong Answer

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

T = [[S[0]]]
for i in S[1:N]:
  if i == T[-1][-1]:
    T[-1].append(i)
  else:
    T.append([i])
T.sort(key=lambda x: len(x))
U = []

U.append(T[-1][0])
c = -2
for i in T[0:len(T)-1]:
  if len(i) == len(T[-1]):
    U.append(i[0])
  else:
    break


U.sort()
for x in U:
  print(x)

Submission status: Wrong Answer

Solution code:
import collections
from collections import OrderedDict

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

#出現回数のカウント
c = OrderedDict(collections.Counter(S))
c_val = list(c.values())
c_key = list(c.keys())

#多い順に並べ替えた辞書をつくる
c_sorted = OrderedDict(sorted(c.items(), key = lambda x : x[1], reverse=True))
c_sorted_key = list(c_sorted)

#表示
print(c_sorted_key[0])
i=1
if len(c_val)>1:
    while c_val[i-1]==c_val[i]:
        print(c_sorted_key[i])
        i+=1
        if i==len(c_val):
            break

Submission status: Wrong Answer

Solution code:
import collections
strlist = []
answer = []
N = int(input())
for i in range(N):
    strlist.append(str(input()))
    
c = collections.Counter(sorted(strlist))
p = max(c.values())
for i in c.most_common():
    if i[1] == p:
        print("{}\n".format(i[0]))

Submission status: Wrong Answer

Solution code:
import collections
strlist = []
N = int(input())
for i in range(N):
    strlist.append(str(input()))
    
c = collections.Counter(sorted(strlist))
p = max(c.values())
for i in c.most_common():
    if i[1] == p:
        print(i[0])

Submission status: Wrong Answer

Solution code:
import collections
strlist = []
N = int(input())
for i in range(N):
    strlist.append(str(input()))
c = collections.Counter(strlist)
p = max(c.values())
for i in c.most_common():
    if i[1] == p:
        print(i[0])

Submission status: Wrong Answer

Solution code:
N=int(input())
s=sorted([input() for i in range(N)])
c=[]
max=0
def remove():
    s.remove(s[0])
def add(max):
    if s.count(s[0]) >= max:
        c.append([s[0],s.count(s[0])])
        max = s.count(s[0])
    return max
while len(s) > 0:
    max = add(max)
    remove()
for i in range(len(c)):
    print(c[i][0])

Submission status: Wrong Answer

Solution code:
import collections
from collections import OrderedDict
 
N = int(input())
l = list(map(str,input().split()))
 
for i in range(len(l)):
    if type(l[i]) == int:
        del l[i]
    
c = collections.Counter(l)
 
A = OrderedDict(sorted(c.items(), key=lambda x:x[1],reverse=True))
B = list(A.items())
l2 = [B[0][0]]
 
for i in range(len(B)-1):
    if B[0][1] == B[i+1][1]:
        l2.append(B[i+1][0])

for i in range(len(l2)):
    print(l[i])

Submission status: Wrong Answer

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

for i in range(N):
  key = input()
  if key in S.keys():
    S[key] = S[key] + 1
  else:
    S[key] = 1

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

A = [S_sorted[0][0]]
i = 0
l = len(S_sorted)

while i < l - 1:
  if S_sorted[i][1] == S_sorted[i + 1][1]:
    A = A + [S_sorted[i][0]]
    i = i + 1
  else:
    break
  
A.sort()
for val in A:
  print(val)

Submission status: Wrong Answer

Solution code:
N = int(input())

cdic = {}
for i in range(N):
    si = input()
    if si not in cdic.keys():
        cdic[si] = 1
    else:
        cdic[si] += 1
        
spair = sorted(cdic.items(), key=lambda x:x[1], reverse=True)
vmax = -1
maxes = []
for pair in spair:
    if pair[1] >= vmax:
        maxes.append(pair[0])
    else:
        break
        
smaxes = sorted(maxes)
for s in smaxes:
    print(s)

Submission status: Wrong Answer

Solution code:
#C-Poll
import collections
n=int(input())
words = [input() for _ in range(n)]
count = collections.Counter(words)
leng = len(count)
ansallay = []
#抽出用に何回出てればansに出すかを変数に突っ込む
record = count.most_common()[0][1]
for num in range(leng-1):
    if(count.most_common()[num][1] == record):
        ansallay.append(count.most_common()[num][0])
    else:
        break
ansallay.sort()
for word in ansallay:
    print(word)

Submission status: Wrong Answer

Solution code:
#C-Poll
import collections
n=int(input())
words = [input() for _ in range(n)]
count = collections.Counter(words)
leng = len(count)
Flg = True
ansallay = []
for num in range(n-1):
    #もし配列が1種類しかなかった場合はそれだけ足してbreakする
    if(leng == 1):
      ansallay.append(count.most_common()[num][0])
      break
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[0][1] != count.most_common()[num+1][1]):
        break
    num += 1
    if(num == leng-1):
      if(count.most_common()[0][1] == count.most_common()[num][1]):
        ansallay.append(count.most_common()[num][0])
      break
for word in ansallay:
    print(word)

Submission status: Wrong Answer

Solution code:
#C-Poll
import collections
n=int(input())
num=0
words = [input() for _ in range(n)]
count = collections.Counter(words)
Flg = True
ansallay = []
while Flg:
    #もし配列が1種類しかなかった場合はbreakする
    if(count.most_common()[0][1] == count.most_common()[0][-1]):
      ansallay.append(count.most_common()[num][0])
      break
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[0][1] != count.most_common()[num+1][1]):
        Flg = False
        break
    num += 1
    if(num == n-1):
      if(count.most_common()[0][1] == count.most_common()[num][1]):
        ansallay.append(count.most_common()[num][0])
      break
ansallay.sort()
for word in ansallay:
    print(word)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = {}
name_list = []
for i in range(N):
  name = input()
  if name not in S:
    S[name] = 1
    name_list.append(name)
  else:
    S[name] += 1
sorted(name_list)
max_vote_name = []
max_vote = -float('inf')
for name in name_list:
  if S[name] > max_vote:
    max_vote = S[name]
    max_vote_list = [name]
  elif S[name] == max_vote:
    max_vote_list.append(name)
for name in max_vote_list:
  print (name)

Submission status: Wrong Answer

Solution code:
N = int(input())
S_list = []
for i in range(N):
  S_list.append(input())
 
sorted(S_list)
name_list = []
vote_list = []
i, j = 0, 0
while i < len(S_list):
  name = S_list[i]
  while j < len(S_list) and S_list[j] == name:
    j += 1
  name_list.append(name)
  vote_list.append(j - i)
  i = j
max_vote = max(vote_list)
for k in range(len(name_list)):
  if vote_list[k] == max_vote:
    print (name_list[k])

Submission status: Wrong Answer

Solution code:
def main():
  n = int(input())
  dict = {}
  for i in range(n):
    s = input()
    dict.setdefault(s, 0)
    dict[s] += 1
  max_val = 0
  ans_ls = []
  for kv in dict.items():
    if kv[1] > max_val:
      max_val = kv[1]
      ans_ls = [kv[0]]    
    elif kv[1] == max_val:
      ans_ls.append(kv[0])


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted([input() for i in range(n)])
s_ = list(set(s))
if len(s_) != n:
    s.append(0)
    co = [1] + [0 for i in range(len(s_)-1)]
    ind = 0
    for i in range(1, n):
        if s[i-1] == s[i]:
            co[ind] += 1
        else:
            ind += 1
            co[ind] += 1
    ma = max(co)
    arg = [i for i in range(len(s_)) if co[i]==ma]
    ans = [s_[i] for i in arg]
    print("\n".join(sorted(ans)))
    
else:
    print("\n".join(s))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted([input() for i in range(n)])
s_ = list(set(s))
if len(s_) != n:
    s.append(0)
    co = [1] + [0 for i in range(len(s_)-1)]
    ind = 0
    for i in range(1, n):
        if s[i-1] == s[i]:
            co[ind] += 1
        else:
            ind += 1
            co[ind] += 1
    ma = max(co)
    arg = [i for i in range(len(s_)) if co[i]==ma]
    ans = [s_[i] for i in arg]
    print("\n".join(sorted(ans)))
    
else:
    print("\n".join(s_))

Submission status: Wrong Answer

Solution code:
import sys
import collections

N = int(input())
S = [str(input()) for i in range(N)]
S_jadge1 = [s for s in S if s.islower()]
# print(S_jadge1)
S_jadge2 = [s for s in S if 1 <= len(s) <= 10]
# print(S_jadge2)
if len(S) != len(S_jadge1):
    sys.exit()
if len(S) != len(S_jadge2):
    sys.exit()
if not 1 <= N <= 2*10*5:
    sys.exit()

c = collections.Counter(S)
max_val = max(c.values())
A = [key for key, value in c.items() if value == max_val]
A = sorted(A)
print('\n'.join(A))
# print(c.items())

Submission status: Wrong Answer

Solution code:
n = int(input())

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

from collections import Counter
c = Counter(s)

result = [i for i in c.items() if i[1]==max(c.values())]

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

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    from collections import Counter

    N = int(input())
    S = [sys.stdin.readline().rstrip('\n') for _ in range(N)]

    print(S)

    c = Counter(S)
    _max = max(c.values())

    keys = [k for k, v in c.items() if v == _max]

    print('\n'.join(sorted(keys)))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
i = int(input())

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


dic2 = sorted(dic.items(), key=lambda x:x[1])
print(dic2)
k = len(dic2)-1
s = 0
ans = []
for p in range(len(dic2)):
    t = dic2[k][1]
    ans.append(dic2[k][0])
    k -= 1
    if t == dic2[k][1]:
        s = 1
    else:
        break
ans.sort(reverse=True)
for ak in ans:
    print(ak)

Submission status: Wrong Answer

Solution code:
i = int(input())

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


dic2 = sorted(dic.items(), key=lambda x:x[1])
print(dic2)
k = len(dic2)-1
s = 0
ans = []
for p in range(len(dic2)):
    t = dic2[k][1]
    ans.append(dic2[k][0])
    k -= 1
    if t == dic2[k][1]:
        s = 1
    else:
        break
ans.sort()
for ak in ans:
    print(ak)

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(s)
common = c.most_common()

count = common[0][1]

for i in common:
  if i[1] == count:
    print(i[0])
  else:
    break

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

s.sort()
cnt = Counter(s).most_common()

if n > 0:
    print(cnt[0][0])
if len(cnt) > 1:
    for i in range(1, n):
        if cnt[i-1][1] == cnt[i][1]:
            print(cnt[i][0])
        else:
            break

Submission status: Wrong Answer

Solution code:
N=int(input())

Di={"":0}

for i in range(N):
    poll=str(input())
    
    if poll in Di.keys():
        Di[poll] += 1
    else:
        Di[poll] = 1

maxvalue=0
maxkey=[]

for k in Di.keys():

    if Di[k] > maxvalue:
        maxvalue=Di[k]
        maxkey=[]
        maxkey.append(k)
    elif Di[k] == maxvalue:
        maxkey.append(k)

for m in maxkey:
    print(m)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
s = []
for _ in range(N):
    s.append(input())
word_nums = dict(sorted(collections.Counter(s).items(), key=lambda x: x[1], reverse=True))
max_num = max(list(word_nums.values()))
output = []
for i, j in word_nums.items():
    if max_num == j:
        output.append(i)
    else:
        break
for i in sorted(output):
    print(i)

Submission status: Wrong Answer

Solution code:
t=int(input())
dict={}
for _ in range(t):
  x=input()
  if x in dict:
    dict[x]+=1
  else:
    dict[x]=1
imax=list(max(dict.items()))
max=imax[-1]
# print(max)
arr=[]
for i in dict:
  if(dict[i]==max):
    arr.append(i)
# print(arr)
arr.sort(key=str)
for i in arr:
  print(i)

Submission status: Wrong Answer

Solution code:
t=int(input())
dict={}
for _ in range(t):
  x=input()
  if x in dict:
    dict[x]+=1
  else:
    dict[x]=1
imax=list(max(dict.items()))
max=imax[-1]
# print(max)
arr=[]
for i in dict:
  if(dict[i]==max):
    arr.append(i)
print(arr)
arr.sort(key=str)
for i in arr:
  print(i)

Submission status: Wrong Answer

Solution code:
Nu=int(input())
dic={}
ls=[]
max=0
for i in range(Nu):
  tmp=input()
  if tmp in dic:
    dic[tmp]=dic[tmp]+1
    max=dic[tmp]
  else:
    dic[tmp]=0
for k,v in dic.items():
  if v==max:
    ls.append(k)
ls.sort()
for x in ls:
  print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections


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

dic = collections.Counter(s)
k = dic.most_common()
m = k[0][1]
mx = m
i = 0
while m == mx: 
    print(k[i][0])
    i += 1
    if i > len(k)-1:
        break
    m = k[i][1]

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(s)
max_num = list(c.values())[0]
d = []
for key,value in c.items():
  if value == max_num:
    d.append(key)

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

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(s)
max_num = list(c.values())[0]
d = []
for key,value in c.items():
  if value == max_num:
    d.append(key)
  else:
    break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
str_list = []
for i in range(N):
  str_list.append(input())
str_set = list(set(str_list))
cnt = [0] * len(str_set)
for i, str in enumerate(str_set):
  cnt[i] = str_list.count(str)

max_cnt = max(cnt)
for i in range(len(cnt)):
  if cnt[i]==max_cnt:
    print(str_set[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
for i in range(n):
    a.append(input())
x=max(a)
c=[]
d=[]
for i in a:
    c.append(a.count(i))
for i in a:
    if a.count(i)==max(c):
        d.append(a[a.index(i)])
d=list(set(d))
for i in d:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
d = {}
for i in range(N):
    s = input()
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1

print(d)

list = sorted(d.values())
print(list)
max_value = max(list)
sorted_list = sorted(d.items(), key=lambda x: x[0])
print(sorted_list)

for i, j in sorted_list:
    if j == max_value:
        print(i)

Submission status: Wrong Answer

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

num = []
num.append(s.count(kesu[0]))
max = []
max.append(0)
for i in range(1,len(kesu)):
    num.append(s.count(kesu[i]))
    if num[i - 1] < num[i]:
        max = []
        max.append(i)
    elif num[i - 1] == num[i]:
        max.append(i) 
       
for  i in range(len(max)):
    print(kesu[max[i]])

Submission status: Wrong Answer

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

num = []
num.append(s.count(kesu[0]))
max = []
max.append(0)
for i in range(1,len(kesu)):
    num.append(s.count(kesu[i]))
    if num[i - 1] < num[i]:
        max = []
        max.append(i)
    elif num[i - 1] == num[i]:
        max.append(i) 
       

print('\n')
for  i in range(len(max)):
    print(kesu[max[i]])

Submission status: Wrong Answer

Solution code:
n = int(input())
b = {}
for i in range(n):
    temp = input()
    if temp not in b:
        b[temp] = 1
    else:
        b[temp] += 1

list1 = sorted(b.items(), key=lambda x: x[1])

a = len(list1)-1
temp = len(list1)-1
list2 = []
while a > 0 and list1[temp][1] == list1[a][1]:
    list2.append(list1[a][0])
    a -= 1
list2.sort()

for a in list2:
    print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())

strs = []
dicts = {}
for i in range(N):
    s = input()
    if dicts.get(s) is not None:
        dicts[s] += 1
    else:
        dicts[s] = 1

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

i = 0
sts = []
for s in dict_sorted:
    if dicts[s[0]] >= i:
        sts.append(s[0])
    i = dicts[s[0]]

for s in sorted(sts):
    print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())

strs = []
dicts = {}
for i in range(N):
    s = input()
    if dicts.get(s) is not None:
        dicts[s] += 1
    else:
        dicts[s] = 1

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

i = 0
for s in dict_sorted:
    if dicts[s[0]] >= i:
        print(s[0])
    i = dicts[s[0]]

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

l = sorted(d.items())
max_v = l[len(l)-1][1]

for k, v in l:
    if v == max_v:
        print(k)
    else:
        continue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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_v = l[0][1]

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

Submission status: Wrong Answer

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