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

n=int(input())
s = []
max = 0

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

c = collections.Counter(s)

for i in c.items():
    if i[1] > max:
        max = i[1]

s2 = [i[0] for i in c.items() if i[1] == max]

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

Submission status: Wrong Answer

Solution code:
def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    print(type(a))
    return sorted(a)

n = int(input())
w = {}
for _ in range(n):
  i = input()
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for j in inverse_lookup(w,m):
  print(j)

Submission status: Wrong Answer

Solution code:
from collections import Counter
 
input_line=int(input())
count=0
input_list=[]
while count < input_line:
  input_list.append(input())
  count+=1
ans_list=[]
list_set=set(input_list)
max_appeard=Counter(input_list).most_common(1)[0][1]
for item in list_set:
    appeard=Counter(input_list)[item]
    if appeard >= max_appeard:
        max_appeard=appeard

Submission status: Wrong Answer

Solution code:
import collections

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

ss=sorted(s)
c = collections.Counter(ss)
print(c.most_common()[0][0])
while k == 0 and i+1<len(c):
    if c.most_common()[i][1]!=c.most_common()[i+1][1]:
        k =1
    else:
        print(c.most_common()[i+1][0])
    i +=1

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
list = []
for i in range(0,N):
    list.append(input())
counted = Counter(list)
[print(letter) for letter,count in counted.most_common() if count == counted.most_common()[0][1]]

Submission status: Wrong Answer

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

s.sort()

ans = []
maxcnt = 0
cnt =0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
  else:
    if maxcnt < cnt :
      maxcnt = cnt
      ans = []
      ans.append(s[i])
      cnt = 0
    elif maxcnt == cnt :
      ans.append(s[i])
      cnt = 0
  if i == len(s)-1:
    if maxcnt < cnt :
      maxcnt = cnt
      ans = []
      ans.append(s[i])
      cnt = 0
    elif maxcnt == cnt :
      ans.append(s[i])
      cnt = 0

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

Submission status: Wrong Answer

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

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

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:
N = int(input())
S = [input() for _ in range(N)]

hash = {}
for i in range(N):
    if S[i] in hash:
        hash[S[i]] += 1
    else:
        hash[S[i]] = 1

max_value = max(hash.values())

result = {}
for i in hash.keys():
    if hash[i] == max_value:
        result[hash[i]] = True

for key in sorted(result.keys()):
    print(key)

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())
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:
import sys
input_first = input()
N= int(input_first)

wordl = []
timesl = []

for i in range(N):
    S = input()
    if S in wordl:
        timesl[wordl.index(S)] +=1
    else:
        wordl.append(S)
        timesl.append(1)

maxval =max(timesl) 
maxind = [j for j,val in enumerate(timesl) if val == maxval]

print("--------------------")
resultl=[]
for i in maxind:
    resultl.append(wordl[i])

resultl.sort()
print(resultl)

Submission status: Wrong Answer

Solution code:
import collections
N= int(input())
S = []
for _ in range(N):
    S.append(input())
    
c = collections.Counter(S)
print(c.most_common()[0][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

print(sorted(word_ans[:ankernum]))

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [input() for i in range(n)]
b = sorted(list(set(a)))
d = {}
for i in b:
    d[i] = a.count(i)

m = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
for i in m:
    print(i)

Submission status: Wrong Answer

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

m = max(counted.values())
chars = [key for key, value in counted.items()
             if value == m]

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

Submission status: Wrong Answer

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

poll = list(dict.fromkeys(vote))
dict = {}
for i in poll:
  dict[i] = vote.count(i)

highest = max(dict.values())
top_element = poll.count(highest)

if top_element != 1:
  for key, value in dict.items():
    if highest == value:
        print(key)
else:
  for key, value in dict.items():
    if highest == value:
        print(key)

Submission status: Wrong Answer

Solution code:
n = int(input())
l=[]
for i in range(n):
    l.append(input())
from collections import Counter
S=Counter(l)#カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})

for letter, count in sorted(S.most_common()):
    print(letter)

Submission status: Wrong Answer

Solution code:

n = int(input())
s = []
for i in range(n):
    x = input()
    s.append(x)
s=sorted(s)
mydict = {}
for i in range(n):
    x = s[i]
    if x in mydict:
        mydict[x]+=1
    else :
        mydict[x] = 1

max_n = 0
for v in mydict.values():
    max_n = max(max_n,v)
for k in mydict:
    if mydict[k] == max_n:
        print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
s.sort()
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:
    if ms >= -1:
      sc = s.count(i)
      if sc > ans:
        ans_l = [i]
        ans = sc
        ms -= sc
      elif sc == ans:
        ans_l.append(i)
        ms -= sc
    else:
      exit()
      
print("\n".join(ans_l))

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-1] == []:
    p = 0
  else:
    b = a[N-i-1]
    b.sort()
    for j in b:
      if j != "":
        print(j)
    break

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.most_common():
    if v != mx:
        exit()    
    print(k)

Submission status: Wrong Answer

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

s.sort()
s.append("")

ans = []
maxcnt = 0
cnt =0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
  else:
    if maxcnt < cnt :
      maxcnt = cnt
      ans = []
      ans.append(s[i])
      cnt = 0
    elif maxcnt == cnt :
      ans.append(s[i])
      cnt = 0
for j in range(len(ans)):
  print(ans[j])

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
S=[]
for i in range(N):
  s=str(input())
  S +=[s]
T=collections.Counter(S)
P=list(T.keys())
Q=list(T.values())
for i in range(len(P)):
  if Q[i]==max(Q):
    print(P[i])

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)
for x in list2:
    print(x)

Submission status: Wrong Answer

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

s_list.sort()

s_dic = {}
for i in range(n):
    if s_list[i] in s_dic:
        continue
    s_dic[s_list[i]] = s_list.count(s_list[i])

value_max = max(s_dic.values())
for key,value in s_dic.items():
    if value == value_max:
        print(key)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
words = [input() for _ in range(n)]
c = collections.Counter(words)
max_c = c.most_common()
ans = [max_c[0][0]]

for i in range(1, len(max_c)):
    if max_c[i][1] == max_c[i-1][1]:
        ans.append(max_c[i][0])
    else:
        break

ans_sorted = sorted(ans, reverse=True)
for i in range(len(ans)):
    print(ans_sorted[i])

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = []
l = [0]

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

s = collections.Counter(s)

for i in s.keys():
    if s[i] > l[0]:
        l.pop(0)
        l.append(s[i])

keys = [k for k, v in s.items() if v == l[0]]


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

Submission status: Wrong Answer

Solution code:
import collections
import itertools

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


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

counter = collections.Counter(A)

mode_v = counter.most_common()[0][-1]

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

for k,v in it:
  print(k)

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

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import collections
N=int(input())
ss = []
for i in range(N):
  ss.append(input())
#d = defaultdict(lambda: 0)
c = collections.Counter(ss)
d_=c.most_common()
d_.sort()
#print(d_)
mx = d_[0][1]
m=len(d_)
for i in range(m):
  if d_[i][1] == mx:
    print(d_[i][0])
  else:
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
for _ in range(n):
  s = input()
  if dic.get(s) == None:
    dic[s] = 1
  else:
    dic[s] += 1

m = max(dic.items())
l = []
for v in dic.items():
  if v[1] == m[1]:
    l.append(v[0])
sortl = sorted(l)
for i in range(len(sortl)):
  print(sortl[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = list(input() for i in range(n))
s.sort()
counted = Counter(s)
m = max(counted.values())
chars = [key for key, value in counted.items() if value == m]

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

Submission status: Wrong Answer

Solution code:
import collections

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

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

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

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
a_dict = {}
max_val = 1
max_key_list = []
for s in sys.stdin:
  s = s.rstrip()
  if s not in a_dict:
    a_dict[s] = 1
    if max_val == 1:
      max_key_list.append(s)
  else:
    a_dict[s] += 1
    if a_dict[s] > max_val:
      max_val = a_dict[s]
      max_key_list = [s]
    else:
      max_key_list.append(s)
max_key_list.sort()
for s in max_key_list:
  print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for val in range(N)]
S.sort()
S_setlist = list(set(S))
S_cnt = []
cnt = 0
for n in S_setlist:
    S_cnt.append(S.count(n))
for m in S_cnt:
    if m == max(S_cnt):
        print(S_setlist[cnt])
        cnt += 1
    else:
        cnt += 1

Submission status: Wrong Answer

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

S.sort()
a = S[0]
c = 0
moji = []

for i in S:
    if a != i:
        moji.append([c,a])
        a = i
        c = 0
    c += 1
if c > 0:
    moji.append([c,a])

moji.sort(reverse=True)
maxc = moji[0][0]
for j in moji:
    if j[0] < maxc: break
    print (j[1])

Submission status: Wrong Answer

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

poll = list(set(vote))
dict = {}
for i in poll:
  dict[i] = vote.count(i)

highest = max(dict.values())
top_element = poll.count(highest)

if top_element != 1:
  for key, value in dict.items():
    if highest == value:
        print(key)
else:
  for key, value in dict.items():
    if highest == value:
        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 = sorted(li)
for v in li:
    print(v)

Submission status: Wrong Answer

Solution code:
import collections

N=int(input())
S=map(str,input().split())
x = collections.Counter(S)

print(x.most_common()[0][0])

Submission status: Wrong Answer

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

hash = {}
for i in range(N):
    if S[i] in hash:
        hash[S[i]] += 1
    else:
        hash[S[i]] = 1

max_value = max(hash.values())

result = {}
for i in hash.keys():
    if hash[i] == max_value:
        result[hash[i]] = True

for key in sorted(hash.keys()):
    print(key)

Submission status: Wrong Answer

Solution code:
import sys
import collections
n = int(input())
s = [input() for i in range(n)]
s = sorted(s)
c = collections.Counter(s)
li = []
max_v = -1
for k,j in c.items():
    li.append([k,j])
    if max_v<j:
        max_v = j
for i in range(len(li)):
    if li[i][1] == max_v:
        print(li[i][0])

Submission status: Wrong Answer

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

info.sort()

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

        tem_record = 1

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:
N = int(input())
D = {}

for i in range(N):
  S = input()
  if S not in D:
    D[S] = 1
  else:
    D[S] += 1
    
E = [k for k, v in D.items() if v == max(D.values())]
print(sorted(E))

Submission status: Wrong Answer

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

import collections

c = collections.Counter(S)

#最頻値の個数
mx = c[max(c)]
#print(mx)


L = set()
for s in S:
    if c[s] == mx:
        L.add(s)

L = list(L)
L.sort()
for l in L:
    print(l)

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:
      if arr[0] != arr[i-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-1] == []:
    p = 0
  else:
    b = a[N-i-1]
    b.sort()
    for j in b:
      if j != "":
        print(j)
    break

Submission status: Wrong Answer

Solution code:
num = int(input())
value = [input() for i in range(num)]
string_count = list(set(value))
string_count.sort()
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:
from collections import Counter

input_line=int(input())
count=0
input_list=[]
while count < input_line:
  input_list.append(input())
  count+=1
ans_list=[]
list_set=set(input_list)
max_appeard=Counter(input_list).most_common(1)[0][1]
print (max_appeard)
for item in list_set:
    appeard=Counter(input_list)[item]
    if appeard >= max_appeard:
        max_appeard=appeard
        ans_list.append(item)
ans_list.sort()
for item in ans_list:
  print (item)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
a = [input() for i in range(n)]

c = Counter(a)
d = c.most_common()

for i in c.items():
   if i[1] == d[0][1]:
     print(i[0])

Submission status: Wrong Answer

Solution code:
import collections

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

counted = collections.Counter(s)

m = max(counted.values())

chars = [key for key, value in counted.items()
             if value == m]
chars.reverse()

moji = '\n'.join(chars)

print(moji)

Submission status: Wrong Answer

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

P=sorted(list(set(S)))
T=[]
m=S.count(P[0])
T.append(P[0])
for i in range(len(P)):
    if S.count(P[i])>m:
        m=S.count(P[i])
        T.clear()
        T.append(P[i])
    elif S.count(P[i])==m:
        T.append(P[i])
for j in range(len(T)):
    print(T[j])

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])
for i in range(len(d)):
  y=int(d[i][1])
  if x==y:
    print(d[i][0])

Submission status: Wrong Answer

Solution code:
n = int(input())

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

len_list = [len(_) for _ in str_list]

ans_list = [moji for len, moji in zip(len_list, str_list) if len == max(len_list)]

print(sorted(ans_list))

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
l = []
for i in range(n):
    l.append(input())
#print(l)
c = dict(collections.Counter(l))
#print(c)
d = dict(sorted(c.items(), key=lambda x:x[1],reverse=True))
#print(d) # [('kokugo', 33), ('eigo', 60), ('sansuu', 85)]
l=[]
for i,v in enumerate(d):
    if i == 0:
        m = d[v]
    if d[v] == m:
        l.append(v)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
s = [input() for i in range(N)]
collections=s
import collections 
c = collections.Counter(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])

Submission status: Wrong Answer

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


data_set = set(data_list)
sorted_list = sorted(data_set)

count_list = [0] * len(sorted_list)

for i in range(len(sorted_list)):
    for j in range(len(data_list)):
        if sorted_list[i] == data_list[j]:
            count_list[i] +=1

max_indexes = [i for i, x in enumerate(count_list) if x == max(count_list)]

for i in range(len(max_indexes)):
    print(sorted_list[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
ls = [input() for i in range(n)]
dict = Counter(ls)
print(max(dict))

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [input() for _ in range(N)]
S.sort()
c = collections.Counter(S)
values, counts = zip(*c.most_common())
if len(values) == 1:
    print(values[0])
else:
    i = 0
    while counts[i] == counts[0]:
        print(values[i])
        i += 1
        if i == N:
            exit()

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
s=[input() for k in range(n)]
s1=[k for k in list(sorted(set(s))) if s.count(k)>1]
c=collections.Counter(s)
p=[]
for i in s1:
    p.append(c[i])
for j, x in enumerate(p):
    if(x == max(p)):
        print(s1[j])

Submission status: Wrong Answer

Solution code:
import collections

n=int(input())

li=[]
ma=0

li=[input() for i in range(n)]

li.sort()
c=collections.Counter(li)
ma=c.most_common()[0][1]


for j in range(n):
    if c.most_common()[j][1]==ma:
        print((c.most_common()[j][0]))
        
        if len(c)==j+1:
            break
    else:
        break

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])
    else:
        break

Submission status: Wrong Answer

Solution code:
n = int(input())

s_dic = dict()
a_dic = dict()

for i in range(n):
  s = input()
  if s not in s_dic:
    s_dic[s] = 1
  else:
    s_dic[s] += 1

# s_dic_sk = sorted(s_dic.items())
s_dic_s = sorted(s_dic.items(), key= lambda x:x[1], reverse=True)

# print(len(s_dic_s))
# print(s_dic_s)

m_count = max(s_dic_s)[1]
# print(m_count)

max_n = True
j = 0

while max_n:
  if s_dic_s[j][1] == m_count:
    a_dic[s_dic_s[j][0]] = s_dic_s[j][1]
    j += 1
    if j == len(s_dic_s):
      max_n = False
  else:
    max_n = False

a_dic_s = sorted(a_dic.items())
    
# print(a_dic_s)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
T = []
L = []
for i in range(0,N):
    S = str(input())
    L.append(S)

T.append([L[0],0])  
for i in range(1,N):
    for j in range(0,len(T)):
        if L[i] == T[j][0]:
            T[j][1] += 1
            break
        elif j == len(T)-1:
            T.append([L[i],1])

Max = 0
for i in range(0,len(T)):
    if T[i][1] > Max:
        Max = T[i][1]

ans = []
for i in range(0,len(T)):
    if T[i][1] == Max:
        ans.append(T[i][0])

ans = sorted(ans)

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N = int(input())
S = [input() for _ in range(N)]
  
d = defaultdict(int)
for k in S:
  d[k] += 1

max_val = max(d.values())
keys_of_max_val = [key for key in d if d[key] == max_val]

for i in keys_of_max_val:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for _ in range(N):
    S.append(input())
 
S_set = list(set(S))
S_dic = {}
M = 0
for s in S_set:
    S_dic[s] = S.count(s)
    M = max(M, S.count(s))
 
S_dic_sorted = sorted(S_dic.items(), key=lambda x: x[0])
for l in S_dic_sorted:
    if l[1] == M:
        print(l[0])
    else:
      break

Submission status: Wrong Answer

Solution code:
from collections import Counter

input_line=int(input())
count=0
input_list=[]
while count < input_line:
  input_list.append(input())
  count+=1
ans={}
ans_list=[]
list_set=set(input_list)
max_appeard=Counter(input_list).most_common(1)[0][1]
print (max_appeard)
for item in list_set:
    appeard=Counter(input_list)[item]
    if appeard >= max_appeard:
        max_appeard=appeard
        ans[item]=appeard
for key,value in ans.items():
    if value==max_appeard:
        ans_list.append(key)
ans_list.sort()
for item in ans_list:
  print (item)

Submission status: Wrong Answer

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

B = Counter(A)

max = [kv for kv in B.items() if kv[1] == max(B.values())]
for i in reversed(max):
    print(i[0])

Submission status: Wrong Answer

Solution code:
from collections import Counter
import collections

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



c = collections.Counter(a)

list = []

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

list.sort()
print(' \n'.join(map(str, list)))

Submission status: Wrong Answer

Solution code:
N = int(input())

S = []
for i in range(N):
    s = input()
    if s in S:
        S[S.index(s) + 1] += 1
    else:
        S.append(s)
        S.append(1)

max = 0
for i in range(len(S) // 2):
    if S[i * 2 + 1] > max:
        max = S[i * 2 + 1]

# 結果の表示
for t in S:
    # print(t)
    if t == max:
        # print(S.index(t) - 1)
        print(S[S.index(t) - 1])
        S[S.index(t)] = 0
# print('result---------')
# print(S)

Submission status: Wrong Answer

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

s.sort()
s.append("a")

ans = []
maxcnt = 0
cnt =0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
  else:
    if maxcnt < cnt :
      maxcnt = cnt
      ans = []
      ans.append(s[i])
      cnt = 0
    elif maxcnt == cnt :
      ans.append(s[i])
      cnt = 0
for j in range(len(ans)):
  print(ans[j])

Submission status: Wrong Answer

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

l = [input() for i in range(n)]
l.sort()
c = Counter(l)

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

for k, v in c.most_common():
    if v == max:
        print(k)
    else:
        exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(input() for i in range(N))
a.sort()
count = 1
max = 0
ls = []
for i in range(N - 1):
  if a[i] == a[i + 1]:
    count += 1
  else:
    if count > max:
      ls = []
      ls.append(a[i])
      max = count
    elif count == max:
      ls.append(a[i])
    count = 1
if count > max:
  ls = []
  ls.append(a[i])
  max = count
elif count == max:
  ls.append(a[i])
if max == 1:
  ls.append(a[N - 1])
ls.sort()
for i in range(len(ls)):
  print(ls[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
a={}
b=[]
for i in range(n):
    s=input()
    if s in a:
        a[s]=a[s]+1
    else:
        a[s]=int(1)
        b.append(s)
c=0
for i in b:
    if c < a[i]:
        c=a[i]
for i in b:
    if a[i]==c:
        print(i)
# print(a)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
a = []
for i in range(N):
  a.append(str(input()))
a = collections.Counter(a)
b = max(a.values())
max_k_list = [kv[0] for kv in a.items() if kv[1] == b]
mak_k_list = sorted(max_k_list)
for i in max_k_list:
  print(i)

Submission status: Wrong Answer

Solution code:
import sys
input_first = input()
N= int(input_first)

wordl = []
timesl = []

for i in range(N):
    S = input()
    if S in wordl:
        timesl[wordl.index(S)] +=1
    else:
        wordl.append(S)
        timesl.append(1)

maxval =max(timesl) 
maxind = [j for j,val in enumerate(timesl) if val == maxval]

for i in maxind:
    print(wordl[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
D = {}
for n in range(N):
    w = input()
    if w not in D:
        D[w] = 0
    else:
        D[w] += 1
d = sorted(D.items(),key=lambda x:-x[1])
m = d[0][1]
for (key, value) in d:
    if value == m:
        print(key)
    else:
        exit()

Submission status: Wrong Answer

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

B = Counter(A)

max = [kv for kv in B.items() if kv[1] == max(B.values())]
# print([i[0] for i in max])
print("///")
for i in reversed(max):
    print(i[0])

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
s = []
d = [0] * 200000 
max = 1

for i in range(n):
    t = stdin.readline().rstrip()
    d[i] = 1
    for ss in s:
        if t == ss:
            d[i] = d[i] + 1
            if max < d[i]:
                max = d[i]
    s.append(t)

result = []        
for cnt in range(len(d)):
    if d[cnt] == max:
        result.append(s[cnt])

print(sorted(result))

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())
  aaaaa = " ".join(ins)
result = dict(Counter(aaaaa))

for k, v in sorted(result.items(), key=lambda x: -x[1]):
  if k != " ":
    aa.append(str(k))
    
print(aa[0])

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
for i in range(n):
  l.append(input())
dic=dict()
for i in range(n):
  if l[i] not in dic:
    dic[l[i]]=1
  else:
    dic[l[i]]+=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:
from collections import Counter

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

c = Counter(s)

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

a = []

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

b = sorted(a)

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

Submission status: Wrong Answer

Solution code:
import collections

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

print_list = []
count = []
S_max = 0

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

values, counts = zip(*S_common)
values = sorted(values)
#print(counts[0])

for i in range(len(values)):
	if counts[0] == counts[i]:
		print(values[i])

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import Counter

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

c = Counter(S)
d = c.most_common()

t = 1

for i in range(1, len(d)):
  if d[0][1] == d[i][1]:
    t += 1
  else:
    pass

for i in range(t):
  print(d[i][0])

Submission status: Wrong Answer

Solution code:
from collections import Counter

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