#K50482. Longest Consecutive Subsequence

    ID: 28874 Type: Default 1000ms 256MiB

Longest Consecutive Subsequence

Longest Consecutive Subsequence

Given a list of integers, find the longest consecutive subsequence in which all the elements are equal. If there are multiple subsequences with the maximum length, return the one that appears first in the sequence.

The input is provided via standard input (stdin) and the output should be printed on standard output (stdout).

Note: If the input list is empty, output nothing.

inputFormat

The first line contains an integer N, the number of integers in the list. The second line contains N integers separated by spaces.

outputFormat

Output the longest consecutive subsequence of equal numbers, with the numbers separated by a single space. If the list is empty, output nothing.

## sample
11
1 2 2 3 3 3 4 4 4 4 5
4 4 4 4