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
import itertools
s=int(input())
l=[input() for i in range(s)]
counter = collections.Counter(l)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, counter.most_common()
)
u=[]
for k, v in it:
  u.append(k)
u.sort
print(*u)

Submission status: Wrong Answer

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

import collections
s_counter = collections.Counter(s_list)

import sys
max_count = s_counter.most_common()[0][1]

s_list_keys = list(s_counter.keys())
s_list_values = list(s_counter.values())

list_ans = []

for i in range(len(s_list_keys)):
    if s_list_values[i] == max_count:
        list_ans.append(s_list_keys[i])
    else:
        sys.exit()

list_ans.sort()

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

Submission status: Wrong Answer

Solution code:
#AtCoder
import collections
N = int(input())
S = []
for i in range(N):
    S.append(input())
s = sorted(S)

c = collections.Counter(s)

mx = max(c.values())

for k,v in c.items():
    if v == mx:
        print(k)

Submission status: Wrong Answer

Solution code:
import collections
from collections import Counter
n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
max = c.most_common()[0][1]
for i in c.items():
    if i[1] == max:
        print(i[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for _ in range(N)]
S.sort()
h = {}
name = set(S)
for n in name:
    h[n] = 0

for s in S:
    h[s] += 1

maxh = h[max(h)]
l = []
for s in set(S):
    if h[s] == maxh:
        l.append(s)

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

Submission status: Wrong Answer

Solution code:
N = int(input().rstrip())
d = {}
for _ in range(N):
    string = input().rstrip()
    if string in d.keys():
        d[string] += 1
    else:
        d[string] = 1
d = sorted(d.items(), key=lambda x:x[1], reverse=True)
print(d)
rets = []
max = -1
for string, val in d:
    if max == -1:
        max = val
    elif max != val:
        break
    rets.append(string)

for a in rets[::-1]:
    print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
d = {}
ans = []
for i in range(n):
  s = input()
  if s not in d:
    d[s] = 1
  else:
    d[s] += 1
d_sorted = sorted(d.items(), key=lambda x:x[1])
d = list(d.items())
score = d[-1][1]
for i in range(len(d)):
  if score == d[i][1]:
    ans.append(d[i][0])
ans.sort()
for i in range(len(ans)):
  print(ans[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c = Counter(l)
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = []
    for i in range(N):
        s = input()
        S.append(s)
#    print(N)
#    print(S)
    sorted(S)
    tmp = {}
    m = 0
    for s in S:
        if s not in tmp.keys():
            tmp[s]=0
        else:
            tmp[s]+=1
        if m<tmp[s]:
            m = tmp[s]
#    print(m, tmp)
    for key in tmp:
        val = tmp[key]
        if val == m:
            print(key)
main()

Submission status: Wrong Answer

Solution code:
from collections import Counter
from itertools import takewhile
n=int(input())
s=[input() for _ in range(n)]
count=Counter(s)
v=count.most_common()[0][-1]
it=takewhile(lambda kv: kv[-1]==v,count.most_common())
for t in list(it):
    print(t[0])

Submission status: Wrong Answer

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

s_set = list(set(s))
s_num = [0]*len(s_set)

for i in range(n):
    s_num[s_set.index(s[i])] += 1

ans_num = max(s_num)
for i in range(len(s_set)):
    if s_num[i] == ans_num:
        print(s_set[i])

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
string_list=[input() for i in range(n)]
l = collections.Counter(string_list)
keys = [k for k, v in l.items() if v == max(l.values())]
for x in range(len(keys)):
	print(keys[x])

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[input() for i in range(N)]
sorted(S)
s=list(set(S))
C=[]
for i in range(len(s)):
  c=0
  for j in range(N):
    if s[i]==S[j]:
      c=c+1
      
  C.append(c)

n=max(C)
for i in range(len(s)):
  if n==C[i]:
    print(s[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections


n = int(input())
ss = []
for i in range(n):
    s = input()
    ss.append(s)
tmp = sorted(ss, key=str.lower)

tmp = collections.Counter(tmp).most_common()

target = tmp[0][1]
ans = ''
for t in tmp:
    if t[1] == target:
        print(t[0])
    else:
        break

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
s = [0] * N
for i in range(N):
  s[i] = str(input())
  
#print(s)
t = collections.Counter(s)
#print(t)
u = list(t.items())
#print(u)
x = u[0][1]
ans = []
for i in range(len(u)):
  if u[i][1] == x:
    ans.append(u[i][0])
    
ans = sorted(ans)

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

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]


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

NUM = [0]*N

S_dict = dict(zip(S, NUM))
for s in S:
	S_dict[s] += 1

S_dict1 = dict(sorted(S_dict.items(), key=lambda x:x[0]))
S_dict2 = dict(sorted(S_dict1.items(), key=lambda x:x[1], reverse=True))
max_ = max(S_dict.values())

for i, j in S_dict2.items():
	if j == max_:
		print(i)

Submission status: Wrong Answer

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

S = sorted(S.items(), key=lambda x: x[1], reverse=True)
S = sorted(S, key=lambda x: x[0])
before = S[0][1]
for i in range(len(S)):
    if before > S[i][1]:
        break
    print(S[i][0])
    before = S[i][1]

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[input() for _ in range(n)]
s.sort()
s.append("X")
#print(s)
a=[]
count=[]
buf=1
for i in range(n):
    if s[i]==s[i+1]:
        buf+=1
    elif buf>1:
        a.append(s[i])
        count.append(buf)
        buf=1
#print(a)
#print(count)
for i in range(len(a)):
    if count[i]==max(count):
        print(a[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
arr = []

for i in range(N):
  a = input()
  arr.append(a)
  
arr.sort()
arr.append("")

a = [[] for i in range(N)]
cnt = 0

for i in range(1,N+1):
  
  if arr[0] != arr[1] and i == 1:
    a[0].append(arr[0])
  
  if arr[i] == arr[i-1]:
    cnt += 1
  else:
    if cnt > 0:
      a[cnt].append(arr[i])
    else:
      cnt = 0
      a[cnt].append(arr[i])
for i in range(N):
  if a[i] == []:
    p = 0
  else:
    b = a[i]
    b.sort()
    for j in b:
      if j != "":
        print(j)
    break

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
L=[]
for i in range(N):
  L.append(input())
S=collections.Counter(L)
ans=[]
MS= max(S.values())
for k,v in S.items():
  if v==MS:
    ans.append(k)
A = ' '.join(ans)
print(A)

Submission status: Wrong Answer

Solution code:
N = int(input())

d_count = {}
for i in range(N):
    S = str(input())
    d_count.setdefault(S, 0)
    d_count[S] = d_count[S] + 1
print(d_count)

max = 0
maxlist = []
for S in d_count:
    if(max < d_count[S] ):
        max = d_count[S]
        maxlist = [S]
    if(max == d_count[S]):
        maxlist.append(S)

maxlist_set = list(set(maxlist))
maxlist_set.sort()
for a in maxlist_set:
    print(a)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
ll=[input() for i in range(N)]
ll=Counter(ll)
ll=ll.most_common()
for i in ll:
    print(i[0])

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

s = s.most_common()

k = s[0][1]
for i in range(len(s)):
    if k == s[i][1]:
        print(s[i][0])
    else:
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
maxim = 0
for i in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
        if dic[s] > maxim:
            maxim = dic[s]
        
dic2 = sorted(dic.items(), key=lambda x:x[1], reverse=True)

ll = []
for i in dic2:
    if i[1] != maxim:
        break
    else:
        ll.append(i[0])
for i in sorted(ll):
    print(i)

Submission status: Wrong Answer

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

D_sorted = sorted(D.items(), key=lambda x:x[0])
D_sorted = sorted(D_sorted, key=lambda x:x[1], reverse=True)
for k in D_sorted:
  print(k[0])

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())

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


c = collections.Counter(s)


max_c = c[max(c)]

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

keys.sort()

for k in keys:
   print(k)

Submission status: Wrong Answer

Solution code:
N = int(input())
name = [input() for i in range(N)]
import collections
'''
name = ""
dic = {}
for i in range(N):
  name = input()
  dic[name] += 1
print(dic)
'''
c = collections.Counter(name)
values, counts = zip(*c.most_common(N))
maxim = counts[0]
answer = []
for val, cnt in zip(values,counts):
  if ( cnt == maxim):
    answer.append(val)
  else:
    break
sorted(answer)
for i in answer:
  print(i)

Submission status: Wrong Answer

Solution code:
a=int(input())
s=[]
f=[]
e=[]
for i in range (a):
  d=input()
  s.append(d)
d=set(s)
for i in d:
  g=s.count(i)
  f.append(g)
q=max(f)
w=[i for i, x in enumerate(f) if x == q]
for i in w:
  e.append(s[i])
e.sort()
for i in e:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())

A = [input() for i in range(N)]

dic = {}

for i in A:
        if i not in dic:
                dic[i] = 1
        else:
                dic[i] += 1

de = 0

ans_list = []
#dic2 =　sorted(dic.values(), reverse=True)

for k, v in sorted(dic.items(), key=lambda x: x[1], reverse = True):
        if v != de and de !=0:
                exit()
        else:
                ans_list.append(k)
        de = v

ans_list_n = sorted(ans_list)

for i in ans_list_n:
        print(i)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N=int(input())
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
  if i!=N-1:
    S=input()[:-1]
  else:
    S=input()
  d[S]+=1
max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
max_k_list.sort()
for a in max_k_list:
  print(a)

Submission status: Wrong Answer

Solution code:
import collections

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

setted_S = set(S)
counted_S = collections.Counter(S)

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

ans_ls.sort()

for i in ans_ls:
    print(i)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

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

dmax = max(d.values())

for key, value in d.items():
    if value == dmax:
        print(key)

Submission status: Wrong Answer

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

import collections

c = collections.Counter(s)
l = [kv[0] for kv in c.items() if kv[1] == max(c.values())]

for i in l:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
dic = {}
for i in range(N):
  s = str(input())
  if not s in dic:
    dic[s] = 1
  else:
    dic[s] += 1
max_k_list = [kv[0] for kv in dic.items() if kv[1] == max(dic.values())]
for i in max_k_list:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())

dic = set()
for i in range(N):
    dic.add(str(input()))

dic = list(dic)
dic.sort()

for i in dic:
    print(i)

Submission status: Wrong Answer

Solution code:
N, strings, answers = int(input()), [], []
for x in range(N):
    string = input()
    strings.append(string)
max_char = strings.count(max(strings, key=strings.count))
for x in strings:
    if strings.count(x) == max_char:
        answers.append(x)
for x in set(answers):
    print(x)

Submission status: Wrong Answer

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

import collections
s_counter = collections.Counter(s_list)

import sys
max_count = s_counter.most_common()[0][1]

s_list_keys = list(s_counter.keys())
s_list_values = list(s_counter.values())

for i in range(len(s_list_keys)):
    if s_list_values[i] == max_count:
        print(s_list_keys[i])
    else:
        sys.exit()

Submission status: Wrong Answer

Solution code:
import collections

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

c_dic = dict(collections.Counter(S))

#for value ,key in c_dic.items():
#dic2 = dict(sorted(c_dic.items(), key=lambda x:x[1], reverse=True))
dic2 = dict(sorted(c_dic.items(), key=lambda x:x[0]))
dic2 = dict(sorted(dic2.items(), key=lambda x:x[1]))
m_dic2 = max(dic2.values())
#print(c_dic, dic2,m_dic2)


for key, value in dic2.items():
    if value == m_dic2:
        print(key)

Submission status: Wrong Answer

Solution code:
#coding:utf-8

n = int(input())

dic = {}
for _ in range(n):
    key = input()
    if key in dic:
        dic[key] += 1
    else:
        dic[key] = 1
        

max_key = max(dic)
max_v = dic[max_key]
li = []
for key in dic:
    if max_v == dic[key]:
        li.append(key)
        
li.sort()
for v in li:
    print(v)

Submission status: Wrong Answer

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

info.sort()

ans = []
record = 0
tem_record = 0
for i in range(n-1):
    if info[i] == info[i+1]:
        tem_record += 1
        if tem_record == record:
            ans.append(info[i])
        elif tem_record > record:
            ans = [info[i]]
    else:
        if tem_record > record:
            record = tem_record
        tem_record = 0

if record == 0 and info[n-1] != info[n-2]:
    ans.append(info[n-1])


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

Submission status: Wrong Answer

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

c = Counter(S)
keys, values = zip(*c.most_common())

for i in range(len(values)):
  if max(values) == values[i]:
    ans_list.append(keys[i])
    
sorted(ans_list)
for i in range(len(ans_list)):
  print(ans_list[i])

Submission status: Wrong Answer

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

max_s = 0
m_str = []
for i in range(n):
	temp = input()
	s.append(temp)
	temp = s.count(s[i])
	#print(temp,s[i],m_str)
	if temp > max_s :
		#print("if")
		max_s = temp
		m_str = []
		m_str.append(s[i])
	elif temp == max_s :
		#print("elif")
		if not s[i] in m_str:
			#print("if not")
			m_str.append(s[i])
score = {}
for i in m_str: score[i] = 1
#print(score)
print("===============")
score_sorted = sorted(score.items(),key=lambda x:x[0])
for ans in score_sorted:
	print(ans[0])

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
A=[input() for i in range(N)]
c = collections.Counter(A)
values, counts = zip(*c.most_common())
k = max (counts)
l =counts.count(k)
V = []
for i in range(l):
  V.append(values[i])
sorted(V)
for j in range(len(V)):
  print(V[j])

Submission status: Wrong Answer

Solution code:
a=int(input())

index_list=[]
list=[]

for i in range(a):
    #print(i)
    inpu=input()
    if inpu in list:
        index_list[list.index(inpu)] +=1
    else:
        list.append(inpu)
        index_list.append(1)

maxm=max(index_list)
max_count=index_list.count(maxm)

for i in range(max_count):
    print(list[index_list.index(maxm)])
    list.remove(list[index_list.index(maxm)])
    index_list.remove(maxm)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
s = [0] * N
for i in range(N):
  s[i] = str(input())
  
t = collections.Counter(s)
u = list(t.items())
x = u[0][1]
ans = []
for i in range(len(u)):
  if u[i][1] == x:
    ans.append(u[i][0])
  else:
    quit()
ans = sorted(ans)

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

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
d={}
for i in range(n):
    x=str(raw_input())
    try:
        d[x]+=1
    except:
        d[x]=0
m=-1
ans=[-1]
for i in d.keys():
    if(d[i]==m):
        ans.append(i)
    elif(d[i]>m):
        m=d[i]
        ans.pop()
        ans.append(i)
ans.sort()
for i in ans:
    print i

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = [input() for i in range(N)]
    set_S = set(S)
    cnt = 0
    ll = []
    for s in set_S:
        s_num = S.count(s)
        if cnt < s_num:
            cnt = s_num
            ll = [s]
        elif cnt == s_num:
            ll.append(s)
        elif cnt > s_num:
            pass

    for l in ll:
        print(l)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
L = [str(input()) for _ in range(N)]
c = Counter(L)
for i, x in enumerate(c.most_common()):
  if i>0 and x[1]!=m:
    break
  print(x[0])
  m = x[1]

Submission status: Wrong Answer

Solution code:
N = int(input())
s = [input()for i in range(N)]
k = {}
for w in s:
    k[w] = 1 if k.get(w) == None else k[w] + 1

biggest = k[max(k)]

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

for i in reversed(res):
    print(i)

Submission status: Wrong Answer

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

import collections

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

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

c_max = C[0][1]

for i, c in enumerate(C):
  if c[1] == c_max:
    print(c[0])
  else:
    break

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
def main():
    N=int(input())
    S=[""]*N
    result={}
    for i in range(N):
        S[i]=input().strip()
        if S[i] not in result:
            result[S[i]]=1
        else:
            result[S[i]]+=1

    result=sorted(result.items())
    print(result)
    result=sorted(result,key=lambda x:-x[1])

    max_num=result[0][1]
    for i in range(len(result)):
        if result[i][1]==max_num:
            print(result[i][0])
        else:
            break
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
ls = [input() for i in range(n)]    
c = collections.Counter(ls)
count = c.most_common()[0][1]
ans = []
if c.most_common()[0][1] == 1:
    ls.sort()
    for i in ls:
        print(i)
elif c.most_common()[-1][1] == count:
    ls.sort()
    for i in ls:
        print(i)
else:
    for i in range(len(c)):
        if c.most_common()[i][1] == count:
            ans.append(c.most_common()[i][0])
        else:
            break   
    ans.sort()
    for i in ans:
      print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
m = max(S.count(S[i]), i in range(N))
S_new = set(S)
for s in S_new:
  if S.count(s) == m:
    print(s)

Submission status: Wrong Answer

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

for i in range(len(se)):
    a.append(s.count(se[i]))

for i in range(len(a)):
    if a[i]==max(a):
        print(se[i])
    else:
        continue

Submission status: Wrong Answer

Solution code:
import collections

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

S.sort()
C = collections.Counter(S).most_common()
M = C[0][1]

for c in C:
    if c[1] == M:
        print(c[0])

Submission status: Wrong Answer

Solution code:
import collections

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

c_dic = dict(collections.Counter(S))

#for value ,key in c_dic.items():
#dic2 = dict(sorted(c_dic.items(), key=lambda x:x[1], reverse=True))
dic2 = dict(sorted(c_dic.items(), key=lambda x:x[0]))
dic2 = dict(sorted(dic2.items(), key=lambda x:x[1]))
m_dic2 = max(dic2.values())
print(c_dic, dic2,m_dic2)


for key, value in dic2.items():
    if value == m_dic2:
        print(key)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())

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

c = collections.Counter(s)

m = 2 * (10**5) + 1

flag = False

out = list()
for k, v in c.most_common():
        if flag and m > v:
                break
        elif m > v:
                flag = True
                m = v
        out += [k]
print(*(out[::-1]), sep='\n')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
for i in range(0, n):
    s.append(input())
my_dict = {i:s.count(i) for i in s}
answer = []
itemMaxValue = max(my_dict.items(), key=lambda x: x[1])
for key, value in my_dict.items():
    if value == itemMaxValue[1]:
        answer.append(key)

for x in answer:
    print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [0 for i in range(n)]
dics = {}
for i in range(n):
    try:
        s = input()
        a = dics[s]
        dics[s] += 1
    except KeyError:
        dics[s] = 1
max_v = max(dics.values())
max_k_list = [kv[0] for kv in dics.items() if kv[1] == max(dics.values())]
for i in max_k_list:
    print(i)

Submission status: Wrong Answer

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul
from collections import Counter


Num = int(stdin.readline().rstrip())
data = []
for el in range(Num):
    data.append(stdin.readline().rstrip())
data.sort()

counter = Counter(data)
past = -1
for el in counter.most_common():
    if past > el[1]:
        break
    if past <= el[1]:
        print(el[0])
    past = el[1]

Submission status: Wrong Answer

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

a=sorted(a)
b=[]
c=[]

tmp="."
count=0

for i in range(n):
  if tmp != a[i]:
    b.append(tmp)
    c.append(count)
    tmp=a[i]
    count=1
  else:
    count += 1
 
b.append(tmp)
c.append(count)
k=sorted(c)[0]
for i in range(len(b)):
  if c[i]==k:
    print(b[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
d = {}
for i in range(n):
	s = input()
	if s in d:
		d[s] += 1
	else:
		d[s] = 1
l = list(d.items())
l = sorted(l, key=lambda x:x[1])
nn = len(l)
m = l[nn-1][1]
i = nn - 1
while l[i][1] == m:
	print(l[i][0])
	i -= 1
	if i == -1:
		break

Submission status: Wrong Answer

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

tmps = input()
max_val = 1
max_string = [tmps]
for i in range(1, N):
    tmps = input()
    if tmps in Sdic:
        Sdic[tmps] += 1
    else:
        Sdic[tmps] = 1

    if Sdic[tmps] > max_val:
        max_val = Sdic[tmps]
        max_string = [tmps]
    elif Sdic[tmps] == max_val:
        max_string.append(tmps)
max_string.sort()
for string in max_string:
    print(string)

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

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:
from collections import Counter

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

cnt = Counter(S)
val = list(cnt.values())
most = val[-1]

ans = []
for i in cnt:
    if cnt[i] == most:
        ans.append(i)

ans.sort()
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
d = {}
for _ in range(n):
    s = input()
    if not s in d:
        d[s] = 1
    else:
        d[s] += 1
d_max = max(d.values())
ans = [k for k, v in d.items() if v == d_max]
for a in ans:
    print (a)

Submission status: Wrong Answer

Solution code:
N = int(input())

nakami = []
kaisu = []
z1 = []
zs = 0

for i in range(N):
    S = input()
    if S in nakami:
      j = nakami.index(S)
      kaisu[j] = kaisu[j] +1
      if kaisu[j]==zs:
        z1.append(S)
        if kaisu[j]>zs:
          z1 = [S]
          zs = kaisu[j]
    else:
        nakami.append(S)
        kaisu.append(1)
        if zs==0:
            zs = 1
        if zs==1:
            z1.append(S)
            
z1.sort()

for i in z1:
    print(i)

Submission status: Wrong Answer

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

info.sort()

ans = []
record = 0
tem_record = 0
for i in range(n-1):
    if info[i] == info[i+1]:
        tem_record += 1
        if tem_record == record:
            ans.append(info[i])
        elif tem_record > record:
            ans = [info[i]]
    else:
        if tem_record > record:
            record = tem_record
        tem_record = 0

if record == 1 and info[n-1] != info[n-2]:
    ans.append(info[n-1])


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, sys.stdin.readline().split(' ')))
def In(): return int(sys.stdin.readline())
def InS(): return sys.stdin.readline()

N = In()

res = {}

for _ in range(N):
    S = InS()
    if(not S in res.keys()):
        res[S] = 0
    res[S] += 1

m = res[max(res)]
resout = []
for k, v in res.items():
    if v == m:
        resout.append(k)

resout.sort()

for s in resout:
    print(s[:-1])

Submission status: Wrong Answer

Solution code:
N=int(input())

D=dict()
for i in range(N): 
    S=input()

    if S not in D:
        D[S]=1
    else:
        D[S]+=1

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

ans.sort()

for s in ans:
    print(s)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]


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

S_dict = dict(zip(S, NUM))
for s in S:
	S_dict[s] += 1

S_dict1 = dict(sorted(S_dict.items(), key=lambda x:x[0]))
S_dict2 = dict(sorted(S_dict1.items(), key=lambda x:x[1], reverse=True))
max_ = max(S_dict.values())

for i, j in S_dict2.items():
	if j == max_:
		print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())

A = [input() for i in range(N)]

dic = {}

for i in A:
        if i not in dic:
                dic[i] = 1
        else:
                dic[i] += 1

de = 0

#dic2 =　sorted(dic.values(), reverse=True)

for k, v in sorted(dic.items(), key=lambda x: x[1], reverse = True):
        if v != de and de !=0:
                exit()
        else:
                print(k)
        de = v

Submission status: Wrong Answer

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul
from collections import Counter


Num = int(stdin.readline().rstrip())
data = []
for el in range(Num):
    data.append(stdin.readline().rstrip())
data.sort()

counter = Counter(data)
print(counter)
past = -1
for el in counter.most_common():
    if past > el[1]:
        break
    if past <= el[1]:
        print(el[0])
    past = el[1]

Submission status: Wrong Answer

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

q = sorted(set(b))
e = [b.count(k) for k in q]

r = []
t = max(e)
for l, p in zip(sorted(b), e):
  if p == t:
    r.append(l)

for h in r:
  print(h)

Submission status: Wrong Answer

Solution code:
case = int(input())
l = [""] * case
for i in range(case):
  l[i] = input()

x = set(l)
cnt = 0
tar = ""
for str in x:
  if cnt < l.count(str):
    cnt = l.count(str)

for str in x:
  if cnt == l.count(str):
    print(str)

Submission status: Wrong Answer

Solution code:
time=int(input())
word=[]
for i in range(time):
    word.append(input())
ans=list(set(word))
for j in range(len(ans)):
    print(ans[j])

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c = Counter(ss)

max_count = max(c.values())
for k, v in c.items():
  if v == max_count:
    print(k)

Submission status: Wrong Answer

Solution code:
N = int(input())

slist = [(input()) for i in range(N)]

sdict = {}

for s in slist:
    if s in sdict:
        sdict[s] += 1
    else:
        sdict[s] = 1


sdict = {k: v for k, v in sorted(sdict.items(), key=lambda x: x[1], reverse=True)}



maxnum = -1

rlist = []

for k, v in sdict.items():
    maxnum = v
    break

for k, v in sdict.items():
    if v == maxnum:
        rlist.append(k)
    if v < maxnum:
        break

rlist.sort(reverse=False)

for r in rlist:
    print(r)

Submission status: Wrong Answer

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

from collections import defaultdict
 
counter = defaultdict(int)
 
for x in S:
    counter[x] += 1

X = counter[max(counter)]
s = set(S)
ans=[]
for i in s:
    if counter[i] == X:
        ans.append(i)

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