34 lines
533 B
Python
34 lines
533 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import sys
|
||
|
|
||
|
def better_algo_X(A):
|
||
|
B = A.copy()
|
||
|
B.sort() # assume mergesort for theta (n * log(n))
|
||
|
|
||
|
x = 1
|
||
|
y = B[0]
|
||
|
k = 1
|
||
|
|
||
|
print(B)
|
||
|
|
||
|
for k in range(1, len(B)):
|
||
|
if B[k] == B[k - 1]:
|
||
|
k = k + 1
|
||
|
else:
|
||
|
if k > x:
|
||
|
y = B[k - 1]
|
||
|
x = k
|
||
|
k = 1
|
||
|
|
||
|
return y
|
||
|
|
||
|
A = []
|
||
|
for line in sys.stdin:
|
||
|
line = line.strip()
|
||
|
if line == '' or line == '\n':
|
||
|
break
|
||
|
A.append(int(line))
|
||
|
|
||
|
print(better_algo_X(A))
|