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 = [];

for i in range(n):
  S.append(input());

c = collections.Counter(S)

num = c.most_common()[0][1];
ans = [];

for i in range(len(c)):
  if c.most_common()[i][1] == num:
    ans.append(c.most_common()[i][0]);
    continue;
    
  else:
    break;
    
for a in range(len(ans)):
  print(ans[a]);

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    dic = {}
    for i in range(n):
        s = input()
        if s in dic:
            dic[s] += 1
        else:
            dic[s] = 1
    max_ = max(dic.values())
    for k,v in dic.items():
        if v == max_:
            print(k)
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for _ in range(n)]
ans = {}
count = []
max_list =[]
for item in s:
    count_i = s.count(item)
    count.append(count_i)

for i in range(n):
    if count[i] == max(count):
        max_list.append(s[i])

for item in set(max_list):
    print(item)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[input() for i in range(N)]
S=sorted(S)
cnt=1
max_cnt=1
ans=[S[0]]
for i in range(N-1):
    if S[i]==S[i+1]:
        cnt+=1
    else:
        cnt=1
    if cnt==max_cnt:
        ans.append(S[i+1])
    if cnt>max_cnt:
        ans=[S[i+1]]
ans=sorted(ans)
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
N=int(input())
S = [input() for _ in range(N)]
maxA=0
B=[]
for i in set(S):
  A=(S.count(i))
  if A > maxA:
    maxA=A
    B = [i]
  if A == maxA and i not in B:
    B.append(i)
[print(j) for j in B]

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
a=[]
for i in range(N):
    a.append(input())
b=collections.Counter(a)
v=list(b.keys())
for i in range(len(v)):
    print(v[i])

Submission status: Wrong Answer

Solution code:

n = int(input())
s = []
for i in range(n):
    s.append(input())
ans = {}
for i in s:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1
print(ans)
ans2 = sorted(ans.items(), key=lambda x:x[1], reverse=True)
print(ans2)
ans_list = {ans2[0][0]}
ans_cnt = ans2[0][1]
for i, j in ans2:
    if ans_cnt == j:
        ans_list.add(i)

ans_list2 = list(ans_list)
ans_list2.sort(reverse=False)
for i in ans_list2:
    print(i)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n=int(input())
mylist=[]
for i in range(n):
    s=input()
    mylist.append(s)
mylist.sort()
#print(mylist)
c=Counter(mylist)

max=sum(x==max(mylist) for x in mylist)
#print(max)
for word,i in c.most_common():
    #print(word,i)
    if i==max:
        print(word)

Submission status: Wrong Answer

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

vote = {}
for i in range(n):
    if s[i] in vote:
        vote[s[i]] +=1
    else:
        vote[s[i]] = 1
max_kv_list = [kv[0] for kv in vote.items() if kv[1] == max(vote.values())]
max_kv_list.sort()

print('¥n'.join(max_kv_list))

Submission status: Wrong Answer

Solution code:
n=int(input())

candidates={}
for i in range(n):
    candidate=input()
    if candidate in candidates:
        candidates[candidate]+=1
    else:
        candidates[candidate]=1
max_k_list = [kv[0] for kv in candidates.items() if kv[1] == max(candidates.values())]
max_k_list.sort()
print(max_k_list)

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
si = []
for i in range(n):
    si.append(input())
ss = collections.Counter(si)
print(ss)

n_ma = max(ss.values())
ans = []
for i in ss.keys():
    if ss[i] == n_ma:
        ans.append(i)

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

Submission status: Wrong Answer

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

l = sorted(dic.items(), key=lambda x: x[1], reverse=True)
num = l[0][1]
for i in range(len(l)):
    if l[i][1] == num:
        print(l[i][0])
    else:
        break

Submission status: Wrong Answer

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

for _ in range(N):
    s = str(input())
    l.append(s)

import collections
c = collections.Counter(l)
c = c.most_common()
c.sort()
most_count = c[0][1]
for i in range(len(c)):
    if c[i][1] == most_count:
        print(c[i][0])

Submission status: Wrong Answer

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

for _ in range(N):
    s = str(input())
    l.append(s)

import collections
c = collections.Counter(l)
c = c.most_common()

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

Submission status: Wrong Answer

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

for _ in range(N):
    s = str(input())
    if s in d.keys():
        d[s] += 1
    else:
        d[s] = 1

sd = sorted(d.items())

for i in range(len(sd)):
    if sd[i][1] == max(d.values()):
        print(sd[i][0])
    else:
        exit()

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

cnt_s = Counter(S)
tmp = cnt_s.most_common()[0][1]
for key, val in sorted(cnt_s.most_common(), key=itemgetter(1)):
		if val == tmp:
      			print(key)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

cnt_s = Counter(S)
tmp = cnt_s.most_common()[0][1]
for key, val in sorted(cnt_s.most_common(), key=itemgetter(1)):
		if val == tmp:
      			print(key)

Submission status: Wrong Answer

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

for _ in range(N):
    s = str(input())
    l.append(s)

import collections
c = collections.Counter(l)

ml = [kv for kv in c.items() if kv[1] == max(c.values())]

for _ in range(len(ml)):
    print(ml[_][0])

Submission status: Wrong Answer

Solution code:
import math
from functools import reduce
import itertools
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))





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

dic={}
results=[]
for s in S:
	if s not in dic:
		dic[s]=1
	else:
		dic[s]+=1
ans=10000010010


score_sorted = sorted(dic.items(), key=lambda x:x[1])
print(score_sorted)
max_count=max(dic.values())
for x in score_sorted:
	if x[1]==max_count:
		results.append(x[0])
results.sort()
for i in results:
	print(i)

Submission status: Wrong Answer

Solution code:
import math
from functools import reduce
import itertools
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))





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

dic={}
results=[]
for s in S:
	if s not in dic:
		dic[s]=1
	else:
		dic[s]+=1
ans=10000010010


score_sorted = sorted(dic.items(), key=lambda x:x[1])
max_count=max(dic.values())
for x in score_sorted:
	if x[1]==max_count:
		print(x[0])

Submission status: Wrong Answer

Solution code:
import math
from functools import reduce
import itertools
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))





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

dic={}
results=[]
for s in S:
	if s not in dic:
		dic[s]=1
	else:
		dic[s]+=1
ans=-1
# for k,v in dic.items():
# 	if ans==0:
# 		ans=v
# 	elif ans==v:

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

for x in score_sorted:
	if x[1]>=ans:
		print(x[0])
		ans=x[1]
	else:
		break

Submission status: Wrong Answer

Solution code:
N=int(input())
d=dict()
A=[]
ma=0
for i in range(N):
  s=input()
  if s not in d:
    d[s]=0
  d[s]+=1
ma=max(d.values())
for i in d:
  if d[i]==ma:
    print(i)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

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

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

Submission status: Wrong Answer

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

word = []
word = list(set(S))
num = [0] * N
for i in range(N):
    num[word.index(S[i])] += 1

for i in range(N):
    if num[i] == max(num):
        print(word[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
List = [input() for i in range(n)]
print(sorted(List))

Submission status: Wrong Answer

Solution code:
from collections import Counter as cnt
n = int(input())
S = [input().replace('\n', '') for _ in range(n)]
S = sorted(S)
S = cnt(S)
m = max(S.values())
for s, i in S.items():
    if i==m: print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

t =[]
count = 1
for i in range(1,n):
  if s[i-1] == s[i] and i != n-1:
    count+=1
  elif s[i-1] == s[i] and i == n-1:
    count += 1
    t.append([s[i-1],count])
  elif i == n-1:
    t.append([s[i-1],1])
  else:
    t.append([s[i-1],count])
    count = 1

t.sort(key=lambda x:x[1])
ma = t[len(t)-1][1]

for i in range(len(t)):
  if t[i][1] == ma:
    print(t[i][0])

Submission status: Wrong Answer

Solution code:
a = int(input())
ans_list =[]
for i in range(a):
    b = input()
    ans_list.append(b)
max_app_map = map(lambda x: ans_list.count(x), ans_list)
max_app=max(list(max_app_map))
print(max_app)
w_list = []
for i in ans_list:
    if ans_list.count(i) == max_app and i not in w_list:
        w_list.append(i)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
li = []
for i in range(n):
    li.append(input())
li.sort()
tmp = list(sorted(set(li), key=li.index))
oplist = [[0 for i in range(2)] for j in range(len(tmp))]
for i in range(len(tmp)):
    oplist[i][1] = tmp[i]
cnt = 0
stmp = li[0]
tmp2=0
for i in range(len(li)):
    if(stmp!=li[i]):
        oplist[tmp2][0] = cnt
        tmp2+=1
        cnt = 0
    if (i + 1 == len(li)):
        oplist[-1][0] = cnt+1
    cnt+=1
    stmp = li[i]
for i in range(len(tmp)):
    if oplist[i][0] == cnt:
        print(oplist[i][1])

Submission status: Wrong Answer

Solution code:
N=input()
n=int(N)

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

q=list(set(p))

maxi=0
big=[]

for i in range(len(q)):
    if maxi<p.count(q[i]):
        maxi=p.count(q[i])
        big.append(q[i])
        big.pop(0)
    if maxi==p.count(q[i]):
        big.append(q[i])
    else:
        continue
big.sort()
for i in range(len(big)):
    print(big[i])

Submission status: Wrong Answer

Solution code:
N=input()
n=int(N)

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

q=list(set(p))

maxi=0
big=[]

for i in range(len(q)):
    if maxi<p.count(q[i]):
        maxi=p.count(q[i])
        big.append(q[i])
        big.pop(0)
    if maxi==p.count(q[i]):
        big.append(q[i])
    else:
        continue

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

Submission status: Wrong Answer

Solution code:
N = int(input())
l = []
for i in range(N):
  l.append(input())
l.sort()
s = set(l)
ss = list(s)
w = []
for i in range(len(ss)):
  w.append(l.count(ss[i]))
for i in range(len(w)):
  if max(w) == w[i]:
    print(ss[i])

Submission status: Wrong Answer

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

#処理
result={}
for i in S:
    if i in result:
        result[i]+=1
    else:
        result[i]=1


x=max(result.values())

for i in result.items():
    if i[1]==x:
        print(i[0])

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
a=[input() for i in range(N)]
a=collections.Counter(a)
values, counts = zip(*a.most_common())
values=sorted(values)
for i in range(len(values)):
    print(values[i])

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
a=[input() for i in range(N)]
a=collections.Counter(a)
values, counts = zip(*a.most_common())
for i in range(len(values)):
    print(values[i])

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[]
for i in range(N):
    S.append(input())
S.sort()
S.reverse()
print(S)
ans=[]
while len(S):
    if len(S)==1:
        x = [S.pop(0), 1]
        ans.append(x)
        break
    x = [S.pop(0), 1]
    for i in S[:]:
        if x[0] == i:
            S.remove(i)
            x[1]+=1
    ans.append(x)

ans.sort(key=lambda x:x[1])
ans.reverse()
for i in range(len(ans)):
    t=ans[0][1]
    if ans[i][1]==t:
        print(ans[i][0])

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[]
for i in range(N):
    S.append(input())
ans=[]
while len(S):
    if len(S)==1:
        x = [S.pop(0), 1]
        ans.append(x)
        break
    x = [S.pop(0), 1]
    for i in S[:]:
        if x[0] == i:
            S.remove(i)
            x[1]+=1
    ans.append(x)

ans.sort(key=lambda x:x[1])
ans.reverse()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections as col
N = int(input())
l = [0]*N
for i in range(N):
    l[i] = input()
ans = []

counter = col.Counter(l)
common = counter.most_common()
ans = []
ans.append(common[0][0])

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

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

Submission status: Wrong Answer

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

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

d = {}
for i in list_a:
  if i in d:
    d[i] = d[i] + 1
  else:
    d[i] = 1

key = sorted([k for k, v in d.items() if v == d[max(d)]])
for i in key:
  print(i)

Submission status: Wrong Answer

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

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

d = {}
for i in list_a:
  if i in d:
    d[i] = d[i] + 1
  else:
    d[i] = 1

key = [k for k, v in d.items() if v == d[max(d)]]
for i in key:
  print(i)

Submission status: Wrong Answer

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

dictionary = dict(Counter(S))
ans = ["z" * 10] * n
i = 0
for k in dictionary.keys():
    if dictionary[k] == max(list(dictionary.values())):
        ans[i] = k
        i += 1

ans.sort()
print(ans)
for a in ans:
     if a == "z" * 10:
         break
     print(a)

Submission status: Wrong Answer

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

dictionary = dict(Counter(S))
ans = ["z" * 10] * n
i = 0
for k in dictionary.keys():
    if dictionary[k] == max(list(dictionary.values())):
        ans[i] = k
        i += 1

ans.sort()
print(ans)
for a in ans:
     if a == "z" * 10:
         sys.exit()
     print(a)

Submission status: Wrong Answer

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

s_list.sort()

max_times = 0
for s in set(s_list):
    times = s_list.count(s)
    if max_times < times:
        max_times = times

for i in range(len(s_list)-max_times-1):
    if s_list[i] == s_list[i+max_times-1]:
        print(s_list[i])

Submission status: Wrong Answer

Solution code:
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

n = load()
A = []
for _ in range(n):
    A.append(load(str))

cnt = defaultdict(int)
mx = 0
mxl = []

for a in A:
    cnt[a] += 1

for key, value in cnt.items():
    if value == mx:
        mxl.append(key)
        continue
    if value > mx:
        mx = value
        mxl = [key]
        continue

for m in mxl:
    print(m)

Submission status: Wrong Answer

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

variety_list=dict(collections.Counter(list1).most_common())

key_list=list(variety_list.keys())
value_list=list(variety_list.values())
list2=[]


for i in range(len(value_list)) :
  if i==0 :
    list2.append(key_list[i])
  elif value_list[0]==value_list[i] :
    list2.append(key_list[i])
  else :
    break

list2.sort()
for item in list2 :
  print(item)

Submission status: Wrong Answer

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

variety_list=dict(collections.Counter(list1).most_common())
print(variety_list)
key_list=list(variety_list.keys())
value_list=list(variety_list.values())
list2=[]


for i in range(len(value_list)) :
  if i==0 :
    list2.append(key_list[i])
  elif value_list[0]==value_list[i] :
    list2.append(key_list[i])
  else :
    break

list2.sort()
for item in list2 :
  print(item)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [input() for _ in range(N)]
count = collections.Counter(S)
maxV = max(count.values())
c = [k for k, v in count.items() if v == maxV]
print('\n'.join(c))

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [input() for _ in range(N)]
v, c = zip(*collections.Counter(S).most_common())
n = c.count(c[0])
print('\n'.join(sorted(v)[:n]))

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = [input() for _ in range(N)]
v, c = zip(*collections.Counter(S).most_common())
n = c.count(c[0])
print('\n'.join(v[:n]))

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
Clist = Counter(S).most_common()
num = Clist[0][1]
anses = [Clist[0][0]]
for X in Clist[1:]:
    if X[1] == num:
        anses.append(X[0])

for ans in anses:
    print(ans)

Submission status: Wrong Answer

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

max = a.count(b[0])

for i in range(len(b)-1):
	if a.count(b[i]) < a.count(b[i+1]):
		max = a.count(b[i+1])

for j in range(len(b)):
	if a.count(b[j]) == max:
		print(b[j])

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
m = max(dic.values())
anslis = []
for k, v in dic.items():
    if v == m:
        anslis.append(k)
print('/n'.join(anslis))

Submission status: Wrong Answer

Solution code:
n = int(input())

word_dict = {}

for i in range(n):
    word = input()
    if word in word_dict:
        word_dict[word] += 1
    else:
        word_dict[word] = 1

max_list = [kv[0] for kv in word_dict.items() if kv[1] == max(word_dict.values())]
sort_list = sorted(max_list)
for i in max_list:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = [input() for _ in range(n)]
s = set(lis)
a = []
for i in s:
    a.append([lis.count(i), i])
M = max(a, key=lambda i : i[0])
anslis = [i[1] for i in a if i[0]==M[0]]
for i in anslis:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = [input() for _ in range(n)]
s = set(lis)
a = []
for i in s:
    a.append([lis.count(i), i])
M = max(s, key=lambda i : i[0])
func = lambda i:i[1] if i[0] == M else None
anslis = [i[1] for i in s if i[0]==M[0]]
for i in anslis:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = sorted(input() for i in range(N))

C = collections.Counter(S)

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

Submission status: Wrong Answer

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

X = []

for i in range(N):
    if [x for x  in dict.fromkeys(S) if S.count(x) >= i+1] != []:
        X = [x for x  in dict.fromkeys(S) if S.count(x) >= i+1]
    else:
        for i in range(len(X)):
            print(X[i])

Submission status: Wrong Answer

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

X = []

for i in range(N):
    if [x for x  in dict.fromkeys(S) if S.count(x) >= i] != []:
        X = [x for x  in dict.fromkeys(S) if S.count(x) >= i]
    else:
        break

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

Submission status: Wrong Answer

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

C = [0] * N

for i in range(N):
    C[i] = S.count(S[i])
    
X = []    

for i in range(N):
    if C[i] == max(C):
        X.append(S[i])

if X == [X[0]] * N:
    print(X[0])
else:
    for i in range(len(X)):
        if X[i] != X[(i+1) % len(X)]:
            print(X[i])

Submission status: Wrong Answer

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

C = [0] * N

for i in range(N):
    C[i] = S.count(S[i])
    
X = []    

for i in range(N):
    if C[i] == max(C):
        X.append(S[i])

if len(X) == N:
    print(X[0])
else:
    for i in range(len(X)):
        if X[i] != X[(i+1) % len(X)]:
            print(X[i])

Submission status: Wrong Answer

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

C = [0] * N

for i in range(N):
    C[i] = S.count(S[i])
    
for i in range(N):
    if C[i] == max(C) and S[i] == S[(i+1) % N]:
        print(S[i])

Submission status: Wrong Answer

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

for i in s:
    if i in dic.keys():
        dic[i] += 1
    else:
        dic[i] = 1
result = []
num = 0
for i in dic.keys():
    if dic[i] > num:
        result = []
        result.append(i)
        num = dic[i]
    elif dic[i] == num:
        result.append(i)
for i in result:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [""] * n
for i in range(n):
    s[i] = input()
s = sorted(s)
t = 1
tmax=1
for i in range(n - 1):
    if s[i] == s[i + 1]:
        t += 1
        tmax=max(tmax,t)
    else:
        t = 1
        tmax = max(tmax, t)
t = 0
if tmax == 1:
    for i in range(n):
        print(s[i])
    exit()
if tmax == n:
    print(s[0])
    exit()
for i in range(n-1):
    if s[i] == s[i + 1]:
        t += 1
        if t == tmax:
            print(s[i+1])
    else:
        t=1

Submission status: Wrong Answer

Solution code:
inpvals = []
lopvals = []
outvals = []

max_loop = int(input())
idx_loop = 0
while idx_loop < max_loop :
  inpvals.append(input())
  idx_loop = idx_loop+1

max_cnt = 0
lopvals = set(inpvals)
for inpval in inpvals :
  cnt = inpvals.count(inpval)

  if max_cnt <= cnt :
    if max_cnt != cnt :
      outvals = []
    max_cnt = cnt
    outvals.append(inpval)

outvals.sort()
    
for outval in outvals :
  print(outval)

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
c = [0 for _ in range(n)]
for i in range(n):
    c[i] = input()
c = collections.Counter(c).most_common()

first = c[0][1]
for i in c:
    if i[1] == first:
        print(i[0])

Submission status: Wrong Answer

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

counts = [val for (key, val) in word_count.items()]
max_count = max(counts)
words = [key for (key, val) in word_count.items() if val == max_count]
for word in words:
    print(word)

Submission status: Wrong Answer

Solution code:
n = int(input())
S = [input() for _ in range(n)]
count = 0
for i in range(n-1):
  for j in range(n-1-i):
    if S[i] == S[j]:
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
x={}

count=0
for i in range(n):
  s=input()
  if s in x:
    x[s]+=1
  else:
    x[s]=1
a=max(x.values())
answer=sorted(x)
for a in answer:
  print(a)

Submission status: Wrong Answer

Solution code:
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/C-.py
#
import collections

# n = int(input())
# l = [str(input()) for i in range(n)]
l = ["beat", "vet", "beet", "bed", "vet", "bet", "beet"]
c = collections.Counter(l)
number_of_words = len(c)
ans_before_sort = [c.most_common()[0][0]]

for i in range(number_of_words):
    if c.most_common()[i][1] == c.most_common()[i+1][1]:
        ans_before_sort.append(c.most_common()[i+1][0])
    else:
        break

ans_after_sort = sorted(ans_before_sort)
print('\n'.join(ans_after_sort))

Submission status: Wrong Answer

Solution code:
import collections

N=int(input())
S=[]
for i in range(N):
	S.append(input())
K=sorted(S)
M=collections.Counter(K)
A=max(M.values())
for i,j in M.items():
	if j==A:
		print(i)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    S = sorted(S)
    UNIQUE = set(S)
    idx = []
    moji = []
    for i in UNIQUE:     # もっとも大きい
        if S.count(i) > 1:
            idx.append(S.count(i))
            moji.append(i)

    if len(idx) > 0:
        MAX = max(idx)
        for i,j in zip(idx, moji):
            if i == MAX: print(j)
    else:
        for i in UNIQUE:
            print(i)

main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    S = sorted(S)
    UNIQUE = set(S)
    idx = []
    moji = []
    for i in UNIQUE:     # もっとも大きい
        if S.count(i) >= 1:
            idx.append(S.count(i))
            moji.append(i)

    MAX = max(idx)
    for i,j in zip(idx, moji):
        if i == MAX: print(j)

main()

Submission status: Wrong Answer

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

a = Counter(s)
b = a.most_common()[0][1]

s = list(set(s)) #sの重複した要素を消す


for i in s:
    if a[i] == b:
        print(i)

Submission status: Wrong Answer

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

s.sort()
count=1
maximum=0

for j in range (N-1):
  if s[j]==s[j+1]:
    count+=1
    if j==N-2:
      if count>maximum:
        a=[]
        a.clear()
        a.append(s[j])
        maximum=count
        number=1
      elif count==maximum:
        a.append(s[j])
        number+=1
  else:
    if count>maximum:
      a=[]
      a.clear()
      a.append(s[j])
      maximum=count
      number=1
    elif count==maximum:
      a.append(s[j])
      number+=1
    count=1   
  if maximum==1 and j==N-2:
    a.append(s[j])
    number+=1
for p in range (number):
  print(a[p])

Submission status: Wrong Answer

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

s.sort()
count=1
maximum=0

for j in range (N-1):
  if s[j]==s[j+1]:
    count+=1
    if j==N-2:
      if count>maximum:
        a=[]
        a.clear()
        a.append(s[j])
        maximum=count
        number=1
      elif count==maximum:
        a.append(s[j])
        number+=1
  else:
    if count>maximum:
      a=[]
      a.clear()
      a.append(s[j])
      maximum=count
      number=1
    elif count==maximum:
      a.append(s[j])
      number+=1
    count=1   
for p in range (number):
  print(a[p])