The most number of times (15 minutes) the sequence appears seeking integer 7-6

The most number of times (15 minutes) the sequence appears seeking integer 7-6

This problem most frequently requested statistics appear integer and an integer number of occurrences of the sequence.

Input formats:

The input sequence is given integer number N (0 <N≤1000), and N integers in a row. Between numbers separated by a space.

Output formats:

In the output line and occurs most often an integer number of occurrences, separated by a space between the numbers. Topic ensure that such numbers are unique.

Sample input:

10 3 2 -1 5 3 4 3 0 3 2

Sample output:

3 4
s = input().split()[1:]

count_max = 0
for i in set(s):
    if s.count(i) > count_max:
        count_max = s.count(i)
        number = i
print(number, count_max)

Guess you like

Origin www.cnblogs.com/fnmain/p/11749931.html
Recommended