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())
ls = [input() for i in range(n)]    
c = collections.Counter(ls)
count = c.most_common()[0][1]
ans = []
if c.most_common()[-1][1] == count:
    ls.sort()
    for i in ls:
      print(i)
else:
    for i in range(len(c)):
        if c.most_common()[i][1] == count:
            ans.append(c.most_common()[i][0])
        else:
            break   
    ans.sort()
    for i in ans:
      print(i)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = sorted([input() for _ in range(N)])
c = collections.Counter(S)
num = c.most_common()[0][1]
for i in range(len(c)):
    if c.most_common()[i][1] == num:
        print(c.most_common()[i][0])
    else:
        break

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c = Counter(ss)

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

Submission status: Wrong Answer

Solution code:

n = int(input())

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

x = set(s)

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


for i in s:
    dic[i] +=1

max_dic = max(dic.values())


for i in x:
    if dic[i] == max_dic:
        print(i)

Submission status: Wrong Answer

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

for i in range(N):
  S.append(input())
  
import collections
c = collections.Counter(S).most_common()
a=c[0][1]
ans=[]
for i in range(len(c)):
  if a==c[i][1]:
    ans.append(c[i][0])
  else:
    exit()
ans.sort()
for i in range(len(ans)):
  print(ans[i])

Submission status: Wrong Answer

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

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)

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

sorted(ret)
for r in ret:
    print(r)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

LL = []
for count in range(N):
    LL.append(str(input()))
LLCount = []
for count in range(N):
    LLCount.append(LL.count(LL[count]))

LLS = []
ss = max(LLCount)

for count in range(N):
    if LLCount[count] == ss:
        LLS.append(LL[count])

LLS.sort()
ans = list(dict.fromkeys(LLS))
for aa in ans:
    print(aa)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_dict = {}
max_val = 1
max_key_list = []
for i in range(n):
  s = input()
  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:
from collections import Counter

N = int(input())

mes_list = []
for i in range(N):
  mes_list.append(input())
count = Counter(mes_list)

answer = [k for k, v in count.items() if v == max(count.values())]
for ans in answer:
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

new_dict = {}
for s in s_list:
    if s not in new_dict.keys():
        new_dict[s] = 1
    else:
        new_dict[s] += 1
    
values = []
keys = []    
for key in new_dict.keys():
    values.append(new_dict[key])
    keys.append(key)
    
values = np.array(values)
keys = np.array(keys)

max_index = values == np.max(values)
keys = keys[max_index].tolist()

for key in keys:
    print(key)

Submission status: Wrong Answer

Solution code:
from collections import Counter

num = int(input())

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

count = Counter(tmp)

for k, v in count.items():
  if count.most_common(1)[0][1] == v:
    print(k)

Submission status: Wrong Answer

Solution code:
n=int(input())

A=[]
B=[]
for i in range(n):
  s=input()
  if s not in A:
    A.append(s)
    B.append(1)
  else:
    B[A.index(s)] += 1

C=[]
for i in range(len(B)):
  C.append([B[i],A[i]])

C = sorted(C,reverse=True)

for i in range(len(C)-1):
  print(str(C[i][1]))
  if C[i][0] != C[i+1][0]:
    exit()

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np
N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
candidate = np.array(list(c.keys()))[np.array(list(c.values())) == max(c.values())]
for i in range(len(candidate)):
  print(candidate[i])

Submission status: Wrong Answer

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

c = collections.Counter(s1)
s2 = c.most_common()
a = 0
for i in range(len(s2)):
    if s2[0][1] == s2[i][1]:
        a = a + 1

for i in range(a):
    print(s2[i][0])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

import collections

n = int(input())
c = collections.Counter([input() for i in range(n)])
m = max(c.values())
k = list(c.keys())
v = list(c.values())
for i in range(len(c)):
    if v[i] == m:
        print(k[i])

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[]
c=[]
for i in range(N):
  tmp=input()
  if not (tmp in S):
    S.append(tmp)
    c.append(1)
  else:
    c[S.index(tmp)]+=1
m=max(c)
for i in range(len(S)):
  if c[i]==m:
    print(S[i])

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = []
    c = {}
    for i in range(N):
        S.append(input())
    S = sorted(S)
    for i in range(N):
        s = S[i]
        c[s] = c[s] + 1 if (s in c)  else 1
    m = max(list(c.values()))
    for s in c.keys():
        if c[s] == m:
            print(s)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import collections
import itertools

# N枚の投票用紙
N = int(input())

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

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

for k, v in it:
    print(k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
S = [input() for i in range(N)]
P={}
A=[]
for i in range(len(S)):
    P[S[i]] = 0
    for j in range(len(S)):
        if S[i]==S[j]:
            P[S[i]] += 1

m=P[S[0]]
for k in range(len(S)):
    if m<P[S[k]]:
        m=P[S[k]]

for k in range(len(S)):
    if P[S[k]]==m:
        A.append(S[k])

A0=set(A)
A1=list(A0)

for List in A1:
    print(List)

Submission status: Wrong Answer

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

for i in range(N):
  S = input()
  if S not in D:
    D[S] = 1
  else:
    D[S] += 1
    
print(D)

Submission status: Wrong Answer

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

from collections import Counter
checked =  Counter(num_list)
before_count = 0
check_count = 0

for keyword, count in sorted(checked.items(), key=lambda x: -x[1]):
    # print(keyword, count)
    if check_count == 0:
        check_count += 1
        print(keyword)
        before_count = count
    else:
        if count != before_count:
            exit()
        else:
            check_count += 1
            print(keyword)
            before_count = count

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[]
L={}
for i in range(N):
    S.append(str(input()))
count_max=0
S.sort()

L[S[0]]=S.count(S[0])
if count_max<L[S[0]]:
    count_max=L[S[0]]

for i in range(1,N):
    if S[i]!=S[i-1]:
        L[S[i]]=S.count(S[i])
    if count_max<L[S[i]]:
        count_max=L[S[i]]

B=list(L.keys())

for i in range(len(B)):
    if L[B[i]]==count_max:
        print(B[i])

Submission status: Wrong Answer

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

for i in range(N):
	S_count = S.count(S[i])
	if S_max <= S_count:
		S_max = S_count
		print_list.append(S[i])

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

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])
    exit()
for i in range(N):
    if counts[i] == counts[0]:
        print(values[i])
    else:
        exit()

Submission status: Wrong Answer

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


value_max = max(dictionary.values())

max_list = []
for k, v in dictionary.items():
    if v == value_max:
        max_list.append(k)

for i in max_list:
    print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
a={}
for i in range(n):
    tmp=input()
    if not tmp in a:
        a[tmp] = 1
    else:
        a[tmp] += 1
ans=sorted(a.items(), key=lambda x: -x[1])
for k, v in a.items():
    if v == max(a.values()):
        print(k)

Submission status: Wrong Answer

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

pre = ""
for i in range(N):
    if pre != S[i]:
        pre = S[i]
        h[S[i]] = 1
    else:
        h[S[i]] += 1

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())
D = dict()
for _ in range(N):
    cand = input()
    if cand not in D:
        D[cand] = 1
    else:
        D[cand] += 1
mx = max(D.values())
A = sorted(D.items(), key=lambda x: -x[1])

for k, m in A:
    if m == mx:
        print(k)
    else:
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
s_list = [input() for _ in range(n)]
most_list = []
counter_dict = {}
for s in s_list:
    if s in counter_dict:
        counter_dict[s] += 1
    else:
        counter_dict[s] = 1

sorted_counter = sorted(counter_dict.items(), key=lambda x: x[1], reverse=True)
ans = []
max_num = sorted_counter[0][1]
for c in sorted_counter:
    if max_num == c[1]:
        ans.append(c[0])
    else:
        break

print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
from collections import Counter

a = int(input())
a_list = []
ans_list = []

for i in range(a):
  a_list.append(input())

a_counter = Counter(a_list)

_v = 0
for k, v in a_counter.most_common():
    if _v == 0 or _v == v:
      _v = v
      ans_list.append(k)
    elif _v > v:
      break

ans = sorted(ans_list)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N = int(input())
d = defaultdict(int)

for _ in range(N):
  d[input()] += 1
  
max_v = d[max(d)]
max_k = [k for k, v in d.items() if v == max_v]

for k in sorted(max_k):
  print(k)

Submission status: Wrong Answer

Solution code:
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())

A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))

D = list(map(int,input().split()))

L = list(map(int,input().split()))
R = list(map(int,input().split()))

T = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
B = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    A.append(x1)
    B.append(y1)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''

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

S.sort()

ans = []
now = 0
renzoku = 0
fin = 0

for i in range(N):
    if i == 3:
        afas = 5
    if S[now] !=S[i]:
        renzoku = i-now





        if fin < renzoku:
            ans.clear()
            ans.append(S[i-1])
            now=i
            fin = renzoku
            renzoku = 0
        elif fin == renzoku:
            ans.append(S[i-1])
            now=i
            fin = renzoku
            renzoku = 0
            if i == N-1 and fin == 1:
                ans.append(S[-1])

    elif i == N-1:
        renzoku = i-now+1
        if fin < renzoku:
            ans.clear()
            ans.append(S[i-1])
            now=i
            fin = renzoku
            renzoku = 0
        elif fin == renzoku:
            ans.append(S[i-1])
            now=i
            fin = renzoku
            renzoku = 0

ans.sort()
remove = -1
for i in range(1, len(ans)):
    if ans[i] == ans[i-1]:
        remove = i


for i in range(len(ans)):
    if i!=remove:
        print(ans[i])

Submission status: Wrong Answer

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

count = {}
for s_i in s:
    if not s_i in count:
        count[s_i] = 0
    count[s_i] += 1
res = sorted(zip(count.keys(), count.values()),
             key=lambda x: x[1], reverse=True)

num = res[0][1]
res2 = []
for res_i in res:
    if res_i[1] != num:
        exit(0)
    res2.append(res_i[0])

res2.sort()
for res2_i in res2:
    print(res2_i)

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(sorted(S))
maxCommon = c.most_common()[0][1]
for x in range(len(c)):
    if maxCommon == c.most_common()[x][1]:
        print(c.most_common()[x][0])

Submission status: Wrong Answer

Solution code:
import collections

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

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

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

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

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
s=[]
for i in range(n):
  S=input()
  s.append(S)
d=collections.Counter(s)
e=list(d.items())
e.sort(key=lambda x:-x[1])
f=list(d.values())
f.sort(reverse=True)
g=list(d.keys())
num=1
for i in range(1,len(f)):
  if f[i]==f[0]:
    num+=1
  else:
    break
lst=[]
for j in range(num):
  lst.append(g[j])
lst.sort()
for j in range(num):
  print(lst[j])

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = []
    unique = set()
    for i in range(N):
        s = input()
        S.append(s)
        unique.add(s)
    
    count = []
    for u in unique:
        count.append(S.count(u))

    max_index = [i for i, x in enumerate(count) if x == max(count)]
    
    for index_ in max_index:
        print(S[index_])
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import collections
# import math


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

    counter = collections.Counter(S)
    _, max_count = counter.most_common()[0]

    for key in counter:
        if (counter[key] == max_count):
            print(key)


resolve()

Submission status: Wrong Answer

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

words = []
cnt = dict()
for i in range(n):
  if s[i] not in words:
    words.append(s[i])
    cnt[s[i]] = 1
  else:
    cnt[s[i]] += 1

cnt_sorted = sorted(cnt.items(), key=lambda x:x[1], reverse=True)
for j in range(len(cnt_sorted)):
  if cnt_sorted[j][1] == cnt_sorted[0][1]:
    print(cnt_sorted[j][0])
  else:
    break

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import collections
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    s = list()
    for i in range(n):
        s.append(str(input()).replace('\n', ''))

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


def main(n, s):
    c = Counter(s)
    max_count = c.most_common()[0][1]
    res = []
    for keys, count in c.most_common():
        if max_count == count:
            res.append(keys)

    print("\n".join(sorted(res)))


if __name__ == "__main__":
    n = int(input())
    s = [input() for _ in range(n)]

Submission status: Wrong Answer

Solution code:
n = int(input())

poll = {}

for i in range(n):
    name = input()
    max_val = 1
    if name not in poll:
        poll[name] = 1
    else:
        poll[name] += 1
        max_val = max(poll[name], max_val)

winner = []

for name, vote in poll.items():
    if vote == max_val:
        winner.append(name)
        
winner.sort()
for w in winner:
    print(w)

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
#l=list(map(int,input().split()))
#a,b,c = map(int,input().split())
d = {}
for i in range(n):
    w = input()
    if w in d:
        d[w] += 1
    else:
        d[w] = 1

#d.sort() # AttributeError: 'dict' object has no attribute 'sort'

d = dict(sorted(d.items(), key=lambda kv: kv[1], reverse=True))
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 = {}
for i in range(n):
    tmp = input()
    if not tmp in s.keys():
        s[tmp] = 1
    else:
        s[tmp] += 1
m = 0
l = []
for i in sorted(s.items(), key=lambda x:x[1], reverse=True):
    if m < i[1]:
        m = i[1]
        l.append(i[0])
    else:
        break

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

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    str_dict = dict()
    for n in range(N):
        s = input()
        if s in str_dict:
            str_dict[s] += 1
        else:
            str_dict[s] = 1
    max_s = max(str_dict.values())
    for a, b in str_dict.items():
        if b == max_s:
            print(a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from collections import Counter

def solve(N: int, S: "List[str]"):
    counter = Counter(S).most_common()

    most_value = counter[0][1]
    answer_list = []

    for key,value in dict(counter).items():
        if value == most_value:
            answer_list.append(key)
        else:
            break
    
    answer_list = list(set(answer_list))
    answer_list.sort()

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

    return


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:
import collections
n=int(input())
l=[input() for i in range(n)]
c = collections.Counter(l)
ll=len(c)
for i in range(ll):
  print(c.most_common()[i][0])

Submission status: Wrong Answer

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

count = {}
for s_i in s:
    if not s_i in count:
        count[s_i] = 0
    count[s_i] += 1
res = sorted(zip(count.keys(), count.values()),
             key=lambda x: x[1], reverse=True)
num = res[0][1]
for res_i in res:
    if res_i[1] != num:
        exit(0)
    print(res_i[0])

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = []
for i in range(n):
    s.append(input())
s = Counter(s)
print(s.most_common()[0][0])
i = 1
p = []
while  i < len(s.most_common()) and s.most_common()[i][1] == s.most_common()[0][1] :
    p.append(str(s.most_common()[i][0]))
    i+=1
p = sorted(p)
for i in range(len(p)):
    print(p[i])

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
list = []
for x in range(n):
    s = input()
    list.append(s)
c = collections.Counter(list)
mc = c.most_common()
max = mc[0][1]
anslist = []
for val in mc:
    if max == val[1]: anslist.append(val[0])
    else: break
anslist.sort
for x in anslist:
    print(x)

Submission status: Wrong Answer

Solution code:
N=int(input())
KnL=[]
VnL=[]

for _ in range(N):
  inp=str(input())
  if not inp in KnL:
    KnL.append(inp)
    VnL.append([0,inp])
  VnL[KnL.index(inp)][0]+=1

VnL.sort()
VnL.reverse()

for i in range(len(VnL)):
  if VnL[0][0]>VnL[i][0]:
    exit()
  print(VnL[i][1])

Submission status: Wrong Answer

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

max_s = 0
m_str = []
for i in range(n):
	temp = s.count(s[i])
	#print(temp,s[i],m_str)
	if temp > max_s :
		#print("if")
		max_s = temp
		m_str = []
		m_str.append(s[i])
	elif temp == max_s :
		#print("elif")
		if not s[i] in m_str:
			#print("if not")
			m_str.append(s[i])
for ans in m_str:
	print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = ["" for _ in range(n)]
for i in range(n):
    s[i] = input()
s.sort()
cnt = 0
m = -1
ans = []
for i in range(n-1):
    if s[i] == s[i + 1]:
        cnt += 1
    else:
        if cnt > m:
            m = cnt
            ans = [s[i]]
        elif cnt == m:
            ans.append(s[i])
        cnt = 0
if cnt > m:
    m = cnt
    ans = [s[i]]
elif cnt == m:
    ans.append(s[i])
# print(s)
for word in ans:
    print(word)

Submission status: Wrong Answer

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

sort()
sorted(reverse=true)

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

Decimal()
'''

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


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

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

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
a=[0]*n
for i in range(n):
    a[i]=str(raw_input())
d={}
for i in a:
    d[i]=0
for i in a:
    d[i]+=1
m=0
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)

# s=set(a)
# ans=[-1]
# m=0
# for i in s:
    # if(a.count(i)==m):
    #     m=a.count(i)
    #     ans.append(i)
    # elif(a.count(i)>m):
    #     m=a.count(i)
    #     ans.pop()
    #     ans.append(i)
ans.sort()
for i in ans:
    print i

Submission status: Wrong Answer

Solution code:
import collections
z = int(input())
a = [input() for i in range(z)]
a = collections.Counter(a).most_common()
a.sort(key = lambda x:x[1],reverse = True)
c = a[0][1]
ans = []
for i in a:
  if i[1] == c:
    ans.append(i[0])
  else:
    break
ans = ans[::-1]
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(S)
a = c.most_common()
m = a[0][1]
print(a[0][0])

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

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S_list = [input() for i in range(N)]
C = collections.Counter(S_list)
L = C.most_common()
max_ = L[0][1]
ans = []
#print("========")
for i in L:
    if i[1] == max_:
        ans.append(i[0])
    else:
        exit()
ans.sort()
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from collections import Counter


def solve(N: int, S: "List[str]"):
    counter = dict(Counter(S).most_common())
    prev_value = None
    answer_list = []

    for key,value in counter.items():
        if prev_value == None:
            answer_list.append(key)
            prev_value = value
        elif prev_value == value:
            answer_list.append(key)
        else:
            break
    
    answer_list = list(set(answer_list))
    answer_list.sort()

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

    return


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

n = int(input())

l = []

for i in range(n):
    l.append(input())
c = collections.Counter(l)
cx = c.most_common()
nm = cx[0][1]
print(cx[0][0])
for i in range(1, len(cx)):
    if (nm == cx[i][1]):
        print(cx[i][0])
    else:
        break

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = [input() for n in range(N)]
S.sort()
S = collections.Counter(S)
M = S.most_common()[0][1]
for a in S.keys():
    if S[a] == M:
        print(a)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N = int(input())
d = defaultdict(int)

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

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

M = d[0][1]

for k, v in d:
    if v == M:
        print(k)
    else:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())

S = [None] * N

m = dict()

for i in range(N):
  s = input()
  if not s in m.keys():
    m[s] = 1
  else:
    m[s] += 1

max_cnt = max(m.values())

ret = []

for k, v in sorted(m.items(), key=lambda x: x[1], reverse=True):
  if v < max_cnt:
    break
  ret.append(k)

ret.sort()
print(ret)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
list = []
for x in range(n):
    s = input()
    list.append(s)
c = collections.Counter(list)
mc = c.most_common()
max = mc[0][1]
for val in mc:
    if max == val[1]: print(val[0])
    else: break

Submission status: Wrong Answer

Solution code:
def main():
    dic = dict()
    N = int(input())
    for i in range(N):
        key = input()
        if key in dic:
            dic[key] += 1
        else:
            dic[key] = 1

    max_k = [kv[0] for kv in dic.items() if kv[1] == max(dic.values())]

    for x in max_k[::-1]:
        print(x)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


def main(n, s):
    c = Counter(s)
    max_count = c.most_common()[0][1]
    res = []
    for keys, count in c.most_common():
        if max_count == count:
            res.append(keys)
        else:
            print("\n".join(sorted(res)))
            return


if __name__ == "__main__":
    n = int(input())
    s = [input() for _ in range(n)]

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
d = defaultdict(int)
N = int(input())
for i in range(N):
    d[input()] += 1
m = max(d.values())
d = sorted(d.items(), key=lambda x:x[1])
d.reverse()
#print(d)
for s in d:
    if s[1] == m:
        print(s[0])
    else:
        exit()
print(d)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[]
L={}
for i in range(N):
    S.append(str(input()))
count_max=0
S.sort()

for i in range(N):
    if S[i] not in L:
        L[S[i]]=1
    else:
        L[S[i]]+=1
    if L[S[i]]>count_max:
        count_max=L[S[i]]
B=list(L.keys())
for i in range(len(B)):
    if L[B[i]]==count_max:
        print(B[i])

Submission status: Wrong Answer

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

import collections

c = collections.Counter(S)

ls_ans = []
ls_ans.append( c.most_common()[0][0] )

a = c.most_common()[0][1]
for i in range(1,len(c)):
    if c.most_common()[i][1]==a:
        ls_ans.append(c.most_common()[i][0])
    else:
        ans = sorted(ls_ans)
        print("\n".join(ans))
        exit()

Submission status: Wrong Answer

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

ans = sorted(dic.items(), key=lambda x:x[1])
ans = ans[::-1]
check = ans[0][1]

for i in range(len(ans)):
    if ans[i][1] == check:
        print(ans[i][0])

Submission status: Wrong Answer

Solution code:
#!python3.4
# -*- coding: utf-8 -*-
# abc155/abc155_c
import sys
import collections

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    c = collections.Counter()
    for _ in range(N):
        c[i2s()] += 1
    most_commons = c.most_common()
    most = most_commons[0][1]
    for mc in most_commons:
        if mc[1] != most:
            break
        print(mc[0])
    return

main()