summaryrefslogtreecommitdiffstats
path: root/Main/Python/2012/S3.py
blob: 6fabc4a6456b62540d78c3166d3fca8ee0a09c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
readings = dict()

most_frequent = None
second_most_frequent = None

N = int(input())
for i in range(N):
    R = int(input())
    if R in readings:
        readings[R] += 1
    else:
        readings[R] = 1

    if most_frequent is None or (
            readings[R] > readings[most_frequent] or (readings[R] == readings[most_frequent] and R > most_frequent)):
        most_frequent = R

test = []
for i in readings:
    test.append((i, readings[i]))


def get_second(a):
    return a[1]


test.sort(reverse=True, key=get_second)
print(test)
f = test[1][1]
for i in test:

second_most_frequent = test[1][0]

print()