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

a = int(input())

s = [input() for i in range(a)]

counter = collections.Counter(s)

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

l = []

for k, v in it:
  l.append(k)

print(sorted(l))

Submission status: Wrong Answer

Solution code:

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

max_n = -1
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= []

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

s.sort()
n =set(s)
n=list(n)

f = []

for i in range(len(n)):
    f.append([n[i],s.count(n[i])])

f.sort(reverse=True,key=lambda f:f[1])
max = f[0][1]
fl=[]
for i in range (len(f)):
    if f[i][1] == max:
        fl.append(f[i][0])
    else:
        break

fl.sort()
ans=(set(fl))
ansf=list(ans)

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

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
l = [input() for _ in [0] * n]

counted = collections.Counter(l)
print(counted)

# 最頻値を求める
m = max(counted.values())
print(m)

# 頻出数の文字を集める
chars = [key for key, value in counted.items()
             if value == m]

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

print(*sorted(chars),sep='\n')

Submission status: Wrong Answer

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

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

s.sort()
n =set(s)
n=list(n)
print(n)

f = []

for i in range(len(n)):
    f.append([n[i],s.count(n[i])])

f.sort(reverse=True,key=lambda f:f[1])
max = f[0][1]
fl=[]
for i in range (len(f)):
    if f[i][1] == max:
        fl.append(f[i][0])
    else:
        break

fl.sort()
ans=(set(fl))
ansf=list(ans)

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

Submission status: Wrong Answer

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

unique_S_lis = list(set(S_lis))
haha = collections.Counter(S_lis)
maxind = [i for i, x in enumerate(list(haha.values())) if x == max(list(haha.values()))]
lis_ans = sorted([unique_S_lis[i] for i in maxind])

for ans in lis_ans:
    print(ans)

Submission status: Wrong Answer

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

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

s.sort()
n =set(s)
n=list(n)
print(n)

f = []

for i in range(len(n)):
    f.append([n[i],s.count(n[i])])

f.sort(reverse=True,key=lambda f:f[1])

max = f[0][0]
fl=[]
for i in range (len(f)):
    if f[i][1] == max:
        fl.append(f[i][0])
    else:
        break

fl.sort()
ans=(set(fl))
ansf=list(ans)

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

Submission status: Wrong Answer

Solution code:
import collections
import itertools

a = int(input())

s = [input() for i in range(a)]

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


N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]
ans = []
for k, v in counted.items():
    if v == res_max:
        ans.append(k)
    else:
        break

ans.sort()
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
n = int(input())
ls=[input() for i in range(n)]
k_ls= [ls[0]]
nk= [1]
max_n= 1
ind =[]
for i in range(1,n):
    count = 0
    for k in range(1,len(k_ls)):
        if ls[i] == k_ls[k]:
            nk[k] += 1
            count += 1

            if max_n < nk[k]:
                max_n = nk[k]
                ind = [k]
            elif max_n == nk[k]:
                ind.append(k)

    if count == 0:
        k_ls.append(ls[i])
        nk.append(1)
ans = []

for i in ind:
    ans.append(k_ls[i])

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

Submission status: Wrong Answer

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


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


if n == 1:
    print(s[0])
elif n >= 2 and len(c.keys()) == 1:
    print(c.most_common()[0][0])
for i in range(len(k)):
    if k[0][0] == k[i][1]:
        ans.append(k[i][0])
    else:
        break
        
ans.sort()
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
from collections import Counter


N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]
print(res_max)
ans = []
for k, v in counted.items():
    if v == res_max:
        ans.append(k)

ans.sort()
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
n = int(input())

s = {}
i = 0
while n > i:
    s_tmp = input()
    if s.get(s_tmp):
        s[s_tmp] += 1
    else:
        s.setdefault(s_tmp, 1)
    i += 1
    
max_k_list = [kv[0] for kv in s.items() if kv[1] == max(s.values())]

for i in max_k_list:
    print(i)

Submission status: Wrong Answer

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

for _ in range(N):
    S.append(input())
S_set = set(S)
S_dict = dict()
for s in S_set:
    S_dict[s] = 0

for val in S:
    S_dict[val] += 1
max_num = max(S_dict.values())
ans = list()
for k, v in S_dict.items():
    if v == max_num:
        ans.append(k)
sorted(ans)
for res in ans:
    print(res)

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
def solve(N: int, S: "List[str]"):
    a=Counter(S)
    values,counts=zip(*a.most_common())
    p=max(list(counts))
    o=list(counts).count(p)
    for i in reversed(range(o)):
        print(list(values)[i])
    return
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

S = list(str(input()) for i in range(n))
SortedS = sorted(S) #辞書式にソート
s = [] #各文字列の回数
S2 = [] #各文字列
count = 1
for i in range(n - 1):
    if i == n - 2:
        if SortedS[i] != SortedS[i + 1]:
            s.append(count)
            s.append(1)
            S2.append(SortedS[i])
            S2.append(SortedS[i + 1])
        else:
            s.append(count)
            S2.append(SortedS[i])
    
    else:
        if SortedS[i] == SortedS[i + 1]:
            count += 1
        else:
            s.append(count)
            S2.append(SortedS[i])
            count = 1

M = max(s)
for i in range(len(s)):
    if s[i] == M:
        print(S2[i])

Submission status: Wrong Answer

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

for i in range(N):
    if S.count(S[i]) > m_count:
        m_str = [S[i]]
        m_count = S.count(S[i])
    elif S.count(S[i]) == m_count:
        m_str.append(S[i])
m_str.sort()
m_str = list(set(m_str))

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [str(input()) for i in range(n)]
l.sort()
i = 0
count = 1
ans = []
max = 1
while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if count >= max:
      max = count
    if i == n-1:
      ans.append([l[n-1], count])

  else:
      ans.append([l[i],count])
      count = 1
      i += 1

for i in ans:
  if i[1] == max:
    print(i[0])

Submission status: Wrong Answer

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

for _ in range(N):
    S.append(input())
S_set = set(S)
S_dict = dict()
for s in S_set:
    S_dict[s] = 0

for val in S:
    S_dict[val] += 1
max_num = max(S_dict.values())
ans = list()
for k, v in S_dict.items():
    if v == max_num:
        ans.append(k)
sorted(ans)
for res in ans:
    for _ in range(max_num):
        print(res)

Submission status: Wrong Answer

Solution code:
import collections
a = int(input())
l = []
for i in range(a):
    l.append(input())
counted = collections.Counter(l)
 
# 最頻値を求める
m = max(counted.values())
 
# 頻出数の文字を集める
chars = [key for key, value in counted.items()
             if value == m]
 
for i in chars:
    print(i)

Submission status: Wrong Answer

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

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

s.sort()

index = 0
str_index = []
count_index = [1]
maxcount = 0

for j in range(n-1):
    if s[j] == s[j+1]:
        count_index[index] += 1
    elif s[j] != s[j+1]:
        if maxcount <= count_index[index]:
            maxcount = count_index[index]        
        count_index.append(1)
        index += 1
        str_index.append(index)

for k in range(index):
    if maxcount == count_index[k]:
        print(s[str_index[k]])

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
from statistics import mode
l = list(map(str, stdin.readline().rstrip().split()))
print(mode(l))

Submission status: Wrong Answer

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


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


if n == 1:
    print(s[0])
elif n >= 2 and len(c.keys()) == 1:
    print(c.most_common()[0][0])
for i in range(len(k)):
    if k[0][0] == k[i][1]:
        ans.append(k[i][0])
    else:
        break
        
ans = sorted(ans)
[print(i) for i in ans]

Submission status: Wrong Answer

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

ans = []
M = 1
cc = []
C = True
for i in s:
  c = 0
  for j in S:
    if i == j:
      c += 1
  cc.append(c)
  if c == 1 and max(cc) >= M:
    C = None
  if c >= M and C == None:
    M = c
    ans.append(i)
ans.sort()


if C == None:
  for i in ans:
    print(i)
else:
  for i in S:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for i 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:
N = int(input())
S = [input() for i in range(N)]
A = []
i = 1
ls = len(S)

S.sort()

while True:
  if ls > i:
    if S[0] == S[i - 1]:
      count = S.count(S[0])
    else:
      count = 0

    if count > i:
      A = [S[0]]
      i = count
    elif count == i:
      A = A + [S[0]]

    S[0:count] = []
    ls = len(S)
    
  else:
    break

for val in A:
	print(val)

Submission status: Wrong Answer

Solution code:
n = int(input())

s = {}
i = 0
while n > i:
    s_tmp = input()
    if s.get(s_tmp):
        s[s_tmp] += 1
    else:
        s.setdefault(s_tmp, 1)
    i += 1
    
max_d = max(s.values())

print(max_d)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ds ={}  

for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
m = max(ds.values())

keys = [k for k,v in ds.items() if v == m]

print(keys)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
B = []
asort = []
for i in range(N):
  A.append(str(input()))
asort = list(set(A))
asort.sort()

for i in range(len(asort)):
  B.append(A.count(asort[i]))

#print(max(B))
ma = max(B)
#print(B.index(ma))
while ma in B:
  print(A[B.index(ma)])
  B[B.index(ma)] = 0

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
s = [input() for i in range(N)]
S = sorted(s)
d = collections.Counter(S)
keys = [k for k, v in d.items() if v == max(d.values())]
s_n = '\n'.join(keys)
print(s_n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
M = 1
cc = []
C = True
for i in s:
  c = 0
  for j in S:
    if i == j:
      c += 1
  cc.append(c)
  if c == 1 and max(cc) >= M:
    C = None
  if c >= M and C == None:
    M = c
    ans.append(i)
ans.sort()


if C == True:
  for i in ans:
    print(i)
else:
  for i in S:
    print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=sorted([input() for k in range(n)])
s3 = sorted(list(set(s)))
if(len(set(s))==len(s)):
    for u in range(len(s)):
        print(s[u])
    exit()
else:
    s1=s2 = [m for m in s3 if s.count(m)>1]
    i = (len(s)-len(s1))//2
    while(len(s2)!=0):
        s2 = [m for m in s3 if s.count(m)>i]
        if(len(s2)==0):
               break
        s1 = s2
        i+=1
for j in s1:
    print(j)

Submission status: Wrong Answer

Solution code:
import collections
import itertools
N = int(input())
S = []
for _ in range(N):
    S.append(input())
counter = collections.Counter(S)
ranking = {}
for k, v in dict(counter).items():
    ranking.setdefault(v, set()).add(k)

print(* ranking[max(ranking.keys())])

Submission status: Wrong Answer

Solution code:
n=input()
s=[]
for i in range(int(n)):
  s.append(input())
m=0
for k in s:
  if s.count(k)>m:
    m=s.count(k)
ans=[]
for j in s:
  if s.count(j)==m:
    ans.append(j)
ans.sort()
[print(i) for i in ans]

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [str(input()) for _ in range(N)]
S_ = [x for x in set(S) if S.count(x) > 1] #重複している要素を取り出す
if len(S_)==0:
    S.sort()
    for i in range(len(S)):
        print(S[i])
else:
    chofuku_number=[S.count(x) for x in S_]
    answer=[S_[i] for i,x in enumerate(chofuku_number) if x==max(chofuku_number)]
    for i in range(len(answer)):
        print(answer[i])
    answer.sort()
    for i in range(len(answer)):
        print(answer[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
S=[]
for i in range(n):
    S.append(input())
S=sorted(S)
from collections import defaultdict
d = defaultdict(int)

for k in S:
    d[k]+=1

d=dict(d)
dmax=max(d)
ansn=d[dmax]
ans=[]
for i in d.keys():
    if d[i]==ansn:
        ans.append(i)

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

Submission status: Wrong Answer

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

dic = {}
for i in range(N):
    if (S[i] in dic.keys()) == False:
        dic[S[i]] = 1
    else:
        dic[S[i]] = dic[S[i]] + 1

sortdic = sorted(dic.items())

m = sortdic[len(sortdic)-1][1]
ans = []
for i in range(len(sortdic)):
    if sortdic[i][1] == m:
        ans.append(sortdic[i][0])

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

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = list(map(str,input().split()))
collections.Counter(S)
print(max(collections.Counter(S)))

Submission status: Wrong Answer

Solution code:
n = int(input())
ls=[input() for i in range(n)]
k_ls= [ls[0]]
nk= [1]
max_n= 0
ind =[]
for i in range(1,n):
    count = 0
    for k in range(1,len(k_ls)):
        if ls[i] == k_ls[k]:

            nk[k] += 1
            count += 1
            if max_n < nk[k]:
                max_n = nk[k]
                ind = [k]

 
            if max_n == nk[k]:
                ind.append(k)

    if count == 0:
        k_ls.append(ls[i])
        nk.append(1)

#ind = [i for i, v in enumerate(nk) if v == max(nk)]
ans = []

for i in ind[1:]:
    ans.append(k_ls[i])

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

Submission status: Wrong Answer

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

C=Counter(S)
A=[]
B=[]

for i,j in C.most_common():
    A.append(i)
    B.append(j)
for k in range(len(A)):
    if B[k]==B[0]:
        print(A[k])

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = [input() for val in range(N)]
S_c = collections.Counter(S)
values, counts = zip(*S_c.most_common())
cnt = 0
for val in counts:
    if val == max(counts):
        print(values[cnt])
        cnt += 1
    else:
        cnt += 1

Submission status: Wrong Answer

Solution code:
import collections
import itertools

def main():
	n=int(input())
	s = []
	for _ in range(n):
		s.append(input())
	s_s = sorted(s)
	counted = collections.Counter(s_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])
main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n =int(input())

d = defaultdict(int)

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

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

max_val = 0
maxes = []
for r in result:
    if max_val > r[1]:
        break
    else:
        max_val = r[1]
        maxes.append(r[0])

print(sorted(maxes))

Submission status: Wrong Answer

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

dic = {}
for i in range(N):
    if (S[i] in dic.keys()) == False:
        dic[S[i]] = 1
    else:
        dic[S[i]] = dic[S[i]] + 1

sortdic = sorted(dic.items())

m = sortdic[len(sortdic)-1][1]
ans = []
for i in range(len(sortdic)):
    if sortdic[i][1] == m:
        ans.append(sortdic[i][0])

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

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)

sorted_items = sorted(
  c.most_common(),
  key = lambda x:(x[1],x[0]))

key, value = zip(*sorted_items)
print(key[0])
for i in range(1,len(key)):
    if(value[0] == value[i]):
        print(key[i])
    else:
        break;

Submission status: Wrong Answer

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

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 collections
N = int(input())
s = [input() for i in range(N)]
S = sorted(s)
d = collections.Counter(S)
l = len(d)
keys = [k for k, v in d.items() if v == max(d.values())]
s_n = '\n'.join(keys)
print(s_n)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
s.sort()
l = sorted(set(s))
if len(s) == len(l):
    print("\n".join(s))
    exit()
if len(l) == 1:
    print("\n".join(s[0]))
    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())

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

ds ={}  
for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
m = max(ds.values())

keys = [k for k,v in ds.items() if v == m]
print(keys)

Submission status: Wrong Answer

Solution code:
n = int(input())
s,t = [],{}
for i in range(n):
  s.append(input())
s.sort()
t[s[0]] = s.count(s[0])
for i in range(1,n):
  if s[i-1] != s[i]:
    t[s[i]] = s.count(s[i])
for i in t.items():
  if i[1] == max(t.values()):
    print(i[0])

Submission status: Wrong Answer

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

ans = []
M = 1
cc = []
C = None
for i in s:
  c = 0
  for j in S:
    if i == j:
      c += 1
  cc.append(c)
  if c != 1 and max(cc) >= M:
    C = True
  if c >= M and C == True:
    M = c
    ans.append(i)
ans.sort()
if C == True:
  for i in ans:
    print(i)
else:
  for i in S:
    print(i)

Submission status: Wrong Answer

Solution code:
import math


def readints():
    return list(map(int, input().split()))


n = int(input())
s = [input() for i in range(n)]
# print(s)
s.sort()
# print(s)
ss = [i for i in s if s.count(i) > 1]
print(ss)

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(List)

leng = len(c)

res.append(c.most_common()[0][0])
for i in range(1, leng):
    if c.most_common()[i][1] >= c.most_common()[i-1][1]:
        res.append(c.most_common()[i][0])
    else:
        break

res = sorted(res)

Submission status: Wrong Answer

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


data_a = [1]
data_list_a = []
data_list_a.append(data_list[0])

for i in range(n):
    a = True
    b = 0
    for j in range(len(data_list_a)):
        if data_list_a[j] == data_list[i]:
            a = False
            data_a[j] += 1
    if a:
        data_list_a.append(data_list[i])
        data_a.append(1)



#print(data_list)
#print(data_list_a)
#print(data_a)
ans_a = []
d = max(data_a)
for i in range(len(data_list_a)):
    if data_a[i] == d:
        ans_a.append(i)

ans = []

for i in range(len(ans_a)):
    ans.append(data_list_a[ans_a[i]])

ans.sort()

if len(ans) != 1:
    for i in range(1, len(ans)):
        print(ans[i])
else:
    g = set(data_list)
    g = list(g)
    if len(g) == n:
        data_list.sort()
        for i in range(n):
            print(data_list[i])
    else:
        print(data_list[0])

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
s.sort()
l = sorted(set(s))
if len(s) == len(l):
    print("\n".join(s))
    exit()
if len(l):
    print("\n".join(s[0]))
    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())
List = [input() for i in range(n)]
res = []

c = collections.Counter(List)

leng = len(c)

res.append(c.most_common()[0][0])
for i in range(1, leng):
    if c.most_common()[i][1] >= c.most_common()[i-1][1]:
        res.append(c.most_common()[i][0])
    else:
        break

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

print(common[0][0])

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

Submission status: Wrong Answer

Solution code:
import collections
import itertools

N = int(input())
L = []
D = {}
for _ in range(N):
    x = input()
    L.append(x)

counter = collections.Counter(L)

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:
from collections import Counter
num = int(input())
value = [input() for i in range(num)]
print(type(value))
votes = Counter(value)
dict = {}

for value in votes.values():
    dict[value] = []

for (key, value) in votes.items():
    dict[value].append(key)
maxVote = sorted(dict.keys(), reverse=True)[0]
if len(dict[maxVote]) > 1:
    print(sorted(dict[maxVote])[0])
else:
    print(dict[maxVote][0])

Submission status: Wrong Answer

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

ans = []
M = 1
cc = []
C = None
for i in s:
  c = 0
  for j in S:
    if i == j:
      c += 1
  cc.append(c)
  if c != 1 and max(cc) > M:
    C = True
  if c >= M and C == True:
    M = c
    ans.append(i)
ans.sort()
if C == True:
  for i in ans:
    print(i)
else:
  for i in S:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(List)

Submission status: Wrong Answer

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

dic = {}
for i in range(N):
    if (S[i] in dic.keys()) == False:
        dic[S[i]] = 1
    else:
        dic[S[i]] = dic[S[i]] + 1

sortdic = sorted(dic.items())

m = sortdic[len(sortdic)-1][1]
ans = []
for i in range(len(sortdic)):
    if sortdic[i][1] == m:
        ans.append(sortdic[i][0])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

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

ds={}  
for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
m = max(ds.values())

keys = [k for k,v in ds.items() if v == m]
print(keys)

Submission status: Wrong Answer

Solution code:
import numpy as np
from operator import itemgetter

N=int(input())
List=[str(input()) for i in range(N)]
SetList=list(set(List))
nc=[List.count(SetList[i]) for i in range(len(SetList))]

print(nc,SetList)
indexmax=np.where(np.array(nc) == np.array(nc).max())[0]
if(len(indexmax)==1):
    print(itemgetter(*indexmax)(SetList))
else:
    for i in sorted(itemgetter(*indexmax)(SetList)):
        print(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:
N = int(input())
S = list()
count = 0
lis = [0]*N
ans = list()
for i in range(N):
  S.append(input())
S.sort()
for i in range(N-1):
  if S[i] == S[i+1]:
    count += 1
  else:
    lis[i] = count
    count = 0
dai = 1
for i in range(N-1):
  if lis[i] < lis[i+1] and dai < lis[i+1]:
    ans.clear()
    ans.append(S[i+1])
    dai = lis[i+1]
  elif lis[i] < lis[i+1] and dai == lis[i+1]:
    ans.append(S[i+1])
    dai = lis[i+1]
if dai == 1 and count == 0:
  [print(i) for i in S]
elif dai == 1 and count == 1:
  print(ans)
elif count == N-1:
  print(S[0])
else:
  [print(i) for i in ans]

Submission status: Wrong Answer

Solution code:
N = int(input())
L = []
for n in range(N):
    S = input()
    L.append(S)
    
L = sorted(L)    
DICT = {}
count_max  = 1
count = 1

for i in range(len(L)-1):
    if L[i]==L[i+1]:
        count += 1
    else:
        if count >= count_max:
            DICT[L[i]] = count
            count_max = count
            count = 1
        else:
            count = 1
            continue
            
    

DICT[L[-1]] = count      
max_k_list = [kv[0] for kv in DICT.items() if kv[1] == max(DICT.values())]

for t in max_k_list:
    print(t)

Submission status: Wrong Answer

Solution code:
import collections
import itertools
N=int(input())
S=[]
Snum=[]

for i in range(N):
    S.append(input())
print(S)
counted= collections.Counter(S)

ret = [letter for letter,count in counted.most_common() if count == counted.most_common()[0][1]]

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

Submission status: Wrong Answer

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

S2 = Counter(S)
max = S2.most_common()[0][1]

A = []
for i in S:
  if S.count(i) == max:
    A.append(i)


for j in set(A):
  print(j)

Submission status: Wrong Answer

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

li = sorted(string_list)
uniq_li = list(set(li))
n_li = []

for s in uniq_li:
  num = li.count(s)
  n_li.append([num, s])

n_li.sort(reverse=True)

max = n_li[0][0]


for i in n_li:
    if i[0] == max:
        print(i[1])
    else:
      break;

Submission status: Wrong Answer

Solution code:
from sys import stdin
import collections
from statistics import mode

n = int(stdin.readline().rstrip())
s = []

for i in range(n):
    s.append(stdin.readline().rstrip())
    
s.sort()
c = collections.Counter(s)

max = c.most_common()[0][1]
for cc in c.most_common():
    if cc[1] < max:
        break
    print(cc[0])

Submission status: Wrong Answer

Solution code:
n = int(input())

S = list(str(input()) for i in range(n))
SortedS = sorted(S) #辞書式にソート
s = [] #各文字列の回数
S2 = [] #各文字列
count = 1
for i in range(n - 1):
    if i == n - 2 and SortedS[i] != SortedS[i + 1]:
        s.append(count)
        s.append(1)
        S2.append(SortedS[i])
        S2.append(SortedS[i + 1])
    
    else:
        if SortedS[i] == SortedS[i + 1]:
            count += 1
            if i == n - 2:
                s.append(count)
                S2.append(SortedS[i])
        else:
            s.append(count)
            S2.append(SortedS[i])
            count = 1

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ds ={}  
for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
max = max(ds.values())

keys = [k for k,v in ds.items() if v == max]

print(keys)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s_list = sorted(list(input() for _ in range(n)))

s = Counter(s_list)

ans_num = max(list(s.values()))

s_1 = list(s.items())

for i in range(len(s_1)):
    if s_1[i][1] == ans_num:
        print(s_1[i][0])

Submission status: Wrong Answer

Solution code:
import collections
 
N = int(input())
l = [input() for _ in range(N)]
 
c = collections.Counter(l)
 
L = c.most_common()
 
values, counts = zip(*c.most_common())
 
A = list(values)
B = list(counts)
 
b = B.count(B[0])
 
a = A[0:b]
 
for i in a[0:]:
		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_value = max(input_dict.values())
for k, v in input_dict.items():
    if v == max_value:
        print(k)