Fashion Elements 4
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
In the given array of integers, your task is to identify the elements that appear most frequently. First, determine the highest frequency of any element in the array, and then list the elements that occur with this frequency. The order of the output should reflect the sequence in which these elements first achieve the maximum frequency in the input.
Input Data
The first line contains the integer N, representing the number of elements in the array. The second line contains N integers, each with an absolute value not exceeding 100.
Output Data
On the first line, output the maximum frequency of any element. On the second line, list the elements that occur with this maximum frequency.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 34%