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())
di=dict()
for i in range(n):
	s = input()
	if s in di.keys():
		di[s]+= 1
	else:
		di[s]=1
di = sorted(di.items(),reverse = True,key = lambda h:h[1])
ans=di[0][0]
print(''.join(sorted(ans)))

Submission status: Wrong Answer

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

jisyo = {}

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

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

m = 10000000000000000

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

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(s)

b, most = c.most_common(1)[0]

for i,j in c.most_common():
  if j != most:
    break
  print(i)

Submission status: Wrong Answer

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

S.sort()

c = collections.Counter(S)

num = max(c.values())
l = len(c)

for i in range(l):
    if c.most_common()[i][1] == num:
        print(c.most_common()[i][0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
lists = []
for n in range(N):
    s = input()
    lists.append(s)
from collections import Counter
counter = Counter(lists)
#print(counter)
anslist = sorted(counter.items(), key = lambda x:x[1])
anslist.reverse()
#print(anslist)
num = anslist[0][1]
len = len(anslist)
#print(num)
for n in range(len):
    if anslist[n][1] == num:
        print(anslist[n][0])
    else:
        pass

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

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

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

ansarray = sorted(S)

P = []
count = 0
maxcount = 0
d = {}

for i in range(N-1):
    if ansarray[i+1] == ansarray[i]:
        d[ansarray[i]] = count
        count = count + 1
    if ansarray[i+1] != ansarray[i]:
        count = 0

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

if count == 0:
    max_k_list = ansarray
for i in range(len(max_k_list)):
    print(max_k_list[i])

Submission status: Wrong Answer

Solution code:
import collections

if __name__ == "__main__":
    N = int(input())
    S = []
    for i in range(N):
        S.append(input())
    S_collect = collections.Counter(S)
    S_tp = []
    for word in S_collect.most_common():
        S_tp.append(word)
    for i  in S_tp:
        if i[1] == S_tp[0][1]:
            print(i[0])
        else:
            exit()

Submission status: Wrong Answer

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

for i in range(N):
    strs.append(input())
count = {}

for i in range(N):
    if strs[i] not in count.keys():
        count[strs[i]] = 1
    elif strs[i] in count.keys():
        count[strs[i]] += 1

sorted_count = {k: v for k, v in sorted(count.items(), key = lambda x: x[1], reverse=True)}
max_count = list(sorted_count.values())[0]
max_items = []
for k, v in sorted_count.items():
    if (v == max_count):
        max_items.append(k)

max_items = sorted(max_items)

for item in max_items:
    print(item)

Submission status: Wrong Answer

Solution code:
def main():
  num = int(input())

  tmp = [input() for i in range(num)]

  tmp2 = {}
  for t in tmp:
    if len(tmp2) == 0:
      tmp2[t] = 1
    else:
      if t in tmp2:
        tmp2[t] += 1
      else:
        tmp2[t] = 1

  tmp2 = sorted(tmp2.items(), key=lambda x:x[1])
  for t in sorted(tmp2):
    if tmp2[0][1] == t[1]:
      print(t[0])

main()

Submission status: Wrong Answer

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

max = max(my_dic.values())
for i in range(max,0,-1):
	keys = [k for k, v in my_dic.items() if v == i]
	keys.sort()
	for i in range(len(keys)):
		print(keys[i])

Submission status: Wrong Answer

Solution code:
import collections

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

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

S.sort()
counter = collections.Counter(S)
common = counter.most_common()

if (len(common) == 1):
    print(common[0][0])
else:
    print(common[0][0])
    tmp = common[0][1]

    for i in range(1, len(common)):
        if (common[i][1] == tmp):
            print(common[i][0])

Submission status: Wrong Answer

Solution code:
from collections import Counter 
num = input()
ins = list()
aa = list()

for abhsa in range(0, int(num)):
  ins.append(input())
cnt = Counter(ins)
result = cnt.most_common()[0][0]
print(result)

Submission status: Wrong Answer

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

if len(c) == 1:
    print(c.most_common()[0][0])
elif len(c) == len(s_list):
    c_list = sorted(c)
    print(c_list[0])
else:
    print(c.most_common()[0][0])
    for i in range(len(c)+1):
        if c.most_common()[0][1] == c.most_common()[i+1][1]:
            print(c.most_common()[i+1][0])
        else:
            break

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
L =  list(str(input()) for i in range(N))
c = collections.Counter(L)
max_k_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
for i in reversed(max_k_list):
    print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())

dic=dict()
for i in range(n):
  s=input()
  if s not in dic:
    dic[s]=1
  else:
    dic[s]+=1
a=max(dic)
b=dic[a]
keys = [k for k, v in dic.items() if v == b]
keys.sort()
for i in range(len(keys)):
  print(keys[i])

Submission status: Wrong Answer

Solution code:
sz = int(input(''))
ary = []
for i in range(0,sz):
  s = input()
  ary.append(s)

map = {}
for w in ary:
  if not w in map:
    map[w] = 1
  else:
    map[w] +=1

max = 0
maxes = []
for k,v in map.items():
  if v > max:
    max = v

for k,v in map.items():
  if v == max:
    maxes.append(k)

for m in maxes:
  print(m)

Submission status: Wrong Answer

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

d = {}
m = 0
for x in s:
    if x in d:
        d[x] += 1
        m = max(m, d[x])
    else:
        d[x] = 0

print(sorted({k:v for k, v in d.items() if v == m}.keys()))

Submission status: Wrong Answer

Solution code:
import sys
import collections

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

# if not 1 <= N <= 2*10*5:
#     sys.exit()

# if not S.islower():
#     print("error:lower")
#     sys.exit()

c = collections.Counter(S)
max_val = max(c.values())
A = [key for key, value in c.items() if value == max_val]
print(*A)
# print(c.items())

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
    elif j==len(counter)-1:
        ankernum=j+1
print(ankernum)
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

for l in sorted(word_ans[:ankernum]):
    print(l)

Submission status: Wrong Answer

Solution code:
import collections

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

i = 0
while (True):
    print(c_most[i][0])
    i += 1
    if i == len(c_most):
        break
    if c_most[i][1] != c_most[i - 1][1]:
        break

Submission status: Wrong Answer

Solution code:
N = input()
S = list(map(str, input().split()))

box = []
S_box = []
last = []
sss = set(S)
an = []

for k in sss:
    S_box.append(k)

for i in range(0, len(sss)):
    box.append(S.count(S_box[i]))

num = max(box)

for a in range(0, len(box)):
    if num == box[a]:
        last.append(a)

for iii in last:
    an.append(S_box[iii])
an = sorted(an)
for aaa in an:
    print("\n")
    print(aaa)

Submission status: Wrong Answer

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

S_common = S.most_common()

for i in range(len(S_common)):
	if S_common[0][1] == S_common[i][1]:
		S_print.append(S_common[i][0])

sorted(S_print)
for i in range(len(S_print)):
	print(S_print[i])

Submission status: Wrong Answer

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

li = []
ans = []
for i in range(n):
    if s[i] in ans:
        li[ans.index(s[i])][1] += 1
    else:
        li.append([s[i], 1])
        ans.append(s[i])
            
                
li.sort(key = lambda x: x[0])
li.sort(key = lambda x: x[1] , reverse = True)

a = max(li)
for i in range(len(li)):
    if a[1] == li[i][1]:
        print(li[i][0])
    else:
        break

Submission status: Wrong Answer

Solution code:
def main():
	n = int(input())
	l = [str(input()) for i in range(n)]
	l.sort()

	sl = list(set(l))
	
	import collections

	c = collections.Counter(l)

	keys = [k for k, v in c.items() if v == max(c.values())]
	print('\n'.join(map(str, keys)))

	
	
 
if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
s.sort()
l = set(s)
ms = len(s) - len(l)
if ms == 0:
    print("\n".join(s))
    exit()

ans = 0
ans_l = []
for i in l:
    sc = s.count(i)
    if sc > ans:
        ans_l = [i]
        ans = sc
    elif sc == ans:
        ans_l.append(i)
      
print("\n".join(ans_l))

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
S=[input() for i in range(N)]
S=sorted(S)
C=collections.Counter(S).most_common()
a=C[0][1]
for i in range(len(C)):
  if C[i][1]==a:
    print(C[i][0])

Submission status: Wrong Answer

Solution code:
def my_index(l, x, default=False):
    return l.index(x) if x in l else default
      
n=int(input())
lk = [0]*n
k=0
ls = []
for i in range(n):
  s = str(input())
  dup = my_index(ls, s, -1)
  if dup == -1:
    ls.append(s)
    lk[k] += 1    
    k += 1
  else:
    lk[dup] += 1

lk_max = [i for i, x in enumerate(lk) if x == max(lk)]

ls_max=[]
for i in range(len(lk_max)):
  ls_max.append(ls[lk_max[i]])

print(sorted(ls_max))

Submission status: Wrong Answer

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


from collections import Counter
 
mycounter = Counter(S)
max_v = max(mycounter.values())
for s, v in mycounter.items():
  if v == max_v:
    print(s)

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(st)
c.most_common()
c_val = list(c.values())
c_key = list(c.keys())

counter = 0
res = []
if len(c_val) == 1:
  print(c_key[0])
else:
  for i in range(len(c_val)):
    if c_val[i] >= counter:
      counter = c_val[i]
      res.append(c_key[i])
  res = list(set(res))
  res.sort()
  
  for i in range(len(res)):
    print(res[i])

Submission status: Wrong Answer

Solution code:
import collections
import itertools
n = int(input())
s = list(input() for i in range(n))
s.sort()
counter = collections.Counter(s)

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

Submission status: Wrong Answer

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

for i in range(N):
    tmp = input()
    S.append(tmp)
S.sort()
if N == 1:
    print(S[0])
    exit()
ans = []
SS = []
count = 1
print(S)
for i in range(N-1):
    if i == N-2:
        if S[i] == S[i+1]:
            count += 1
            ans.append(count)
            SS.append(S[i])
        else:
            ans.append(count)
            SS.append(S[i])
            ans.append(1)
            SS.append(S[i+1])
    elif S[i] == S[i+1]:
        count += 1
    else:
        ans.append(count)
        SS.append(S[i])
        count = 1

m = max(ans)

for i in range(len(SS)):
    if ans[i] == m:
        print(SS[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
k = []
now = 1
maximum = 1
ans = []
#リスト作成
for i in range(N):
    k.append(input())
#投票箱作成
k.sort()
for i in range(N-1):
    #条件比較
    #もしk[i] == k[i+1]だったら(つまり、同じものだったら)
    if k[i] == k[i+1]:
        now += 1
        flag = 1
    #そうでなければ(違ったら)
    else:
        #条件比較
        if   now > maximum:
            #最大値以上で
            ans.clear()
            ans.append(k[i])
            maximum = now
        elif now == maximum:
            #最大値と同値
            ans.append(k[i])
        else:
            #最大値以下
            continue
        now = 1
        flag = 0
        #どの処理でもnowを1、flagを0にする
    if i == N-2:
        #もしiが最後のものだったら、
        if now > maximum:
        #最大値以上で
            ans.clear()
            ans.append(k[i+1])
            maximum = now
        elif now == maximum:
            #最大値と同値
            ans.append(k[i+1])
        else:
            #最大値以下
            break
        now = 1
for j in range(len(ans)):
    print(ans[j])

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)
from functools import cmp_to_key
import locale
for i in sorted(ans, key=cmp_to_key(locale.strcoll)):
    print i

Submission status: Wrong Answer

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

c = collections.Counter(S_list)

words = []
counter = 0


while(True):
  words.append(c.most_common()[counter][0])
  try:
    if c.most_common()[counter][1] == c.most_common()[counter+1][1]:
      counter += 1
    else:
      break
  except:
    break

words = sorted(words)
print("--")
for j in range(len(words)):
  print(words[j])

Submission status: Wrong Answer

Solution code:
import collections
a = int(input())
li1 = []

for i in range(a):
    li1.append(str(input()))

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

print(c.most_common()[0][0])
for i in range(1,len(c)):
    if( c.most_common()[0][1] == c.most_common()[i][1] ):
        print(c.most_common()[i][0])
    else:
        break

Submission status: Wrong Answer

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

for i in S:
  if i in s:
    s[i] += 1
  else:
    s[i] = 1
 
max_val = max(s.values())
 
for key, value in s.items():
  if value == max_val:
    print(key)

Submission status: Wrong Answer

Solution code:
N = input()
S = list(map(str, input().split()))

box = []
S_box = []
last = []
sss = set(S)
an = []

for k in sss:
    S_box.append(k)

for i in range(0, len(sss)):
    box.append(S.count(S_box[i]))

num = max(box)

for a in range(0, len(box)):
    if num == box[a]:
        last.append(a)

for iii in last:
    an.append(S_box[iii])
an = sorted(an)
for aaa in an:
    print(aaa)

Submission status: Wrong Answer

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

S = set(s)
c_m = int(0)
l = []
ans = []

for i in range(len(S)):
    a = S.pop()
    c_i = int(s.count(a))
    if c_i >= c_m:
        c_m = c_i
        l.append([c_m, a])
        continue

l.sort(reverse = True)
for i in range(len(l)):
    if l[0][0] == l[i][0]:
        ans = l[i][1]
        print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
lists = []
for n in range(N):
    s = input()
    lists.append(s)
from collections import Counter
counter = Counter(lists)
#print(counter)
anslist = sorted(counter.items(), key = lambda x:x[1])
anslist.reverse()
#print(anslist)
num = anslist[0][1]
len = len(anslist)
#print(num)
for n in range(len):
    if anslist[n][1] == num:
        print(anslist[n][0])
    else:
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
list1 = []
for x in range(n): 
  list1.append(input())
  
setlist= list(set(list1))
max = max(list(map(len,setlist)))
ans = list(filter(lambda x:len(x) == max,setlist))
ans = sorted(ans)

for l in ans:
  print(l)

Submission status: Wrong Answer

Solution code:
num = int(input())
value = [input() for i in range(num)]
string_count = list(set(value))
set_num = set()
diction = {}
for data in string_count:
    diction[data] = value.count(data)
    set_num.add(value.count(data))

list_num = list(set_num)
list_num.sort()
number = list_num[-1]
for x, y in diction.items():
    if int(y) == number:
        print(x)

Submission status: Wrong Answer

Solution code:
d={}
k=0
j=0
for i in range(int(input())):
    s=input()
    if d.get(s) is None:
        d[s]=1
    else:
        d[s]+=1
for i in sorted(d,key=d.get,reverse=True):
    print(i)
    k=d[i]
    break
for i in sorted(d,key=d.get,reverse=True):
    j+=1
    if j>1:
        if d[i]==k:
            print(i)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
S = [input() for i in range(N)]
S.sort()
input_dict = defaultdict(int)
for key in S:
    input_dict[key] += 1

max_list = [kv for kv in input_dict.items() if kv[1] == max(input_dict.values())]
for i in range(len(max_list)):
    print(max_list[i][0])

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c = Counter(s)
ans_number = c.most_common()[0][1]

s_max = []
for i in range(len(c)):
  if c.most_common()[i][1] == ans_number:
    s_max.append(c.most_common()[i][0])
  else:
    break;

for a in s_max:
  print(a)

Submission status: Wrong Answer

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

S_common = S.most_common()
#print(S_common)

for i in range(len(S_common)):
	if S_common[0][1] == S_common[i][1]:
		S_print.append(S_common[i][0])

for i in range(len(sorted(S_print))):
	print(S_print[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
#li = ['apple', 'orange', 'apple', 'banana', 'grape','orange']
li = []
for i in range(n):
    li.append(input())

#print(li)
#出現回数がもっとも多いタプルを返す（でもこれだと同一の場合１つしか出てこない...）
dic = Counter(li)
#print(dic.most_common())
#print(max(dic.values()))
max = max(dic.values())

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
s.sort()
counter = Counter(s)

values, counts = zip(*counter.most_common())
maxcount = max(counts)

for word, cnt in counter.most_common():
	if maxcount == cnt:
		print (word)

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+1)]
cnt = 0

for i in range(1,N+1):
  
  if arr[0] != arr[1] and i == 1:
    a[1].append(arr[0])
  
  if arr[i] == arr[i-1]:
    cnt += 1	
  else:
    if cnt > 1:
      a[cnt].append(arr[i-1])
      cnt = 1
    else:
      cnt = 1
      if arr[0] != arr[i-1]:
        a[cnt].append(arr[i-1])

for i in range(N):
  if a[N-i] == []:
    p = 0
  else:
    b = a[N-i]
    b.sort()
    for j in b:
      if j != "":
        print(j)
    break

Submission status: Wrong Answer

Solution code:
n = int(input())

lis = []

for _ in range(n):
    lis.append(input())

dic = {}
for i in lis:
    dic[i] = 0

for e in lis:
    dic[e] += 1

max_list = [e[0] for e in dic.items() if e[1] == max(dic.values())]
for i in reversed(max_list):
    print(i)

Submission status: Wrong Answer

Solution code:
import collections
a = int(input())
li1 = []

for i in range(a):
    li1.append(str(input()))

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
import sys

input = sys.stdin.readline

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

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

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

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

Submission status: Wrong Answer

Solution code:
n=int(input())
b=0
c=0
list=[]
list2=[]
for i in range(n):
    s=input()
    list.append(s)
for x in list:
    b=list.count(x)
    if b>=c:
        c=b
for x in list:
    if c==list.count(x):
        list2.append(x)
for x in list2:
    if list2.count(x)>=2:
        list2.remove(x)
list2.sort()
for x in list2:
    print(x)

Submission status: Wrong Answer

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

S.sort()

c = collections.Counter(S)

ans = [x for x in c.most_common() if x[1]==max(c.values())]

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
vote = []

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

c = Counter(vote)
m = max(c.values())
r = [k for k in c if c[k] == m]

print(r)

Submission status: Wrong Answer

Solution code:
import collections
import itertools
N=int(input())
#P=list(map(int,input().split()))
st=[]
for i in range(N):
    s=str(input())
    st.append(s)
c = collections.Counter(st)
count=c.most_common()
max=count[0][1]
min=count[-1][1]
if max==min:
    st.sort()
    for k in st:
        print(k)
    exit()
ret=[]
for letter,cou in count:

     if cou == max:
         ret.append(letter)
     else:
         break
ret.sort()
for r in ret:
    print(r)

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(l)

values, counts = zip(*c.most_common())
values = sorted(values)
cnt = 0
for i in range(len(counts)):
  str = values[i]
  if cnt < counts[i]:
    cnt = counts[i]
    print(str)
  elif cnt == counts[i]:
    print(str)
  else:
    break

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
l = sorted(set(s))
ms = len(s) - len(l)
if ms == 0:
    print("\n".join(s))
    exit()

ans = 0
ans_l = []
for i in l:
    sc = s.count(i)
    if sc > ans:
        ans_l = [i]
        ans = sc
    elif sc == ans:
        ans_l.append(i)
      
print("\n".join(ans_l))

Submission status: Wrong Answer

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

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


def calculate(n,arr):
    res = {}
    for ar in arr:
        if res.get(ar) == None:
            res.__setitem__(ar, 1)
        else:
            res.__setitem__(ar, res.get(ar) + 1)

    values = list(res.values())
    values.sort(key=lambda x:-x)
    maxValue = values[0]
    results = []

    for re in res:
        if res.get(re) == maxValue:
            results.append(re)

    sorted(results)

    for index in range(len(results)):
        print(results[len(results) - (index + 1)])

calculate(n,arr)

Submission status: Wrong Answer

Solution code:
import collections

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

s = collections.Counter(S)

max_val = max(s.values())

for key, value in s.items():
  if value == max_val:
    print(key)

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

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

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

Submission status: Wrong Answer

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


numbers = dict()
for val in s:
    if val in numbers:
        numbers[val] += 1
    else:
        numbers[val] = 1

[print(kv[0]) for kv in numbers.items() if kv[1] == max(numbers.values())]

Submission status: Wrong Answer

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

for i in range(0, n):
    vote.append(str(input()))

most = dict()
for i in vote:
    if i not in most:
        most.update({
            i : 1
        })
    else:
        most[i] += 1

best = most[max(most)]

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

strList = list([])

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

strDict = {}

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

maxList = list([])

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

print(sorted(maxList))

Submission status: Wrong Answer

Solution code:
import sys

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

#sort by value
counter_sorted = sorted(counter.items(), key=lambda x:x[1], reverse = True)

print
print(counter_sorted)
print

tmp = counter_sorted[0][1]
output = []
L = len(counter)
for i in range(L):
    if tmp == counter_sorted[i][1]:
        output.append(counter_sorted[i][0])
    else:
        break

#sort by key
output = sorted(output)
for i in output:
    print(i)

Submission status: Wrong Answer

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

c = collections.Counter(List)
c_sorted = sorted(c.items(), key=lambda x:x[1],reverse=True)

maxCount = c_sorted[0][1]
keys = [k for k, v in c.items() if v ==maxCount]
for s in keys:
    print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

s = sorted(s)
d = {s[0]:1}
for i in range(1, n):
	if s[i-1] == s[i]:
		d[s[i]] += 1
	else:
		d[s[i]] = 1

m = max(d)

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

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
S=[input() for i in range(N)]
S=sorted(S)
C=collections.Counter(S).most_common()
for i in range(len(C)):
  print(C[i][0])

Submission status: Wrong Answer

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

li = [[s[0],1]]
for i in range(1,n):
    for j in range(len(li)):
        if s[i] in li[j]:
            li[j][1] += 1
            break
        if j == len(li) - 1:
            li.append([s[i],1])
                
li.sort(key = lambda x: x[0])
li.sort(key = lambda x: x[1] , reverse = True)

a = max(li)
for i in range(len(li)):
    if a[1] == li[i][1]:
        print(li[i][0])
    else:
        break

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
s.sort()
s_cnt = Counter(s)
s_cnt_common = s_cnt.most_common()
max_cnt = s_cnt_common[0][1]
for i in range(len(s_cnt_common)):
    if s_cnt_common[i][1] == max_cnt:
        print(s_cnt_common[i][0])

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)

count = 0
check = 0
for el in counter.most_common():
    if count == 0:
        print(el[0])
        check = el[1]
        count = 1
        continue
    if check == el[1]:
        print(el[0])

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

for l in sorted(word_ans[:ankernum]):
    print(l)

Submission status: Wrong Answer

Solution code:
n=int(input())
string_list=[input() for i in range(n)]
import collections
import numpy as np
c = collections.Counter(string_list)
d=c.most_common()
x=int(d[0][1])
z=[]
for i in range(len(d)):
  y=int(d[i][1])
  if x==y:
    z.append(str(d[i][0]))
    
z.sort(reverse=True)
for i in range(len(z)):
  print(z[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for i in range(N)]
S.sort()
maxi = 0
tmp = 0
ans = []
for i in range(N-1):
  if S[i] == S[i+1]:
    tmp += 1
  else:
    if tmp > maxi:
      maxi = tmp
      ans.clear()
      ans.append(S[i])
    elif tmp == maxi:
      ans.append(S[i])
    tmp = 0
  if i == N-2:
      if S[i] == S[i+1]:
        if tmp > maxi:
          maxi = tmp
          ans.clear()
          ans.append(S[i])
        elif tmp == maxi:
          ans.append(S[i])
      else:
        if maxi == 1:
          ans.append(S[N-1])
for i in range(len(ans)):
  print(ans[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
s = [input() for i in range(N)]
collections=sorted(s)
import collections 
c = collections.Counter(sorted(s))
A=c.most_common()[0][1]
for i in range(len(c)):
    if c.most_common()[i][1]==A:
        print(c.most_common()[i][0])
    else :
        break

Submission status: Wrong Answer

Solution code:
n =int(input())
P = [input() for i in range(n)]
P.sort
S = list(set(P))
S.sort
N = [0] * len(S)

for i in range(len(S)):
  for x in P:
    if S[i] == x:
      N[i] += 1

M = max(N)
for i in range(len(S)):
  if N[i] == M:
    print(S[i])