#C11615. Consecutive Occurrences Count

    ID: 40951 Type: Default 1000ms 256MiB

Consecutive Occurrences Count

Consecutive Occurrences Count

Given a list of integers, your task is to count the number of consecutive occurrences for each integer and output the counts in order. For instance, if the list is given as [1, 1, 2, 2, 2, 3, 3, 1], then the correct output would be [2, 3, 2, 1].

Problem Details:

  • You will be provided with an integer N that represents the number of elements in the list.
  • The next line contains N space-separated integers.
  • Your program must calculate and output, in a single line, the counts of consecutive occurrences of each distinct segment of numbers in the order they appear.

Input: Read the input from stdin.

Output: Write the output to stdout as space-separated integers.

inputFormat

The first line of input contains an integer N (the number of elements in the list). The second line contains N space-separated integers.

outputFormat

Output a single line containing the counts of consecutive occurrences for each segment of numbers, with each number separated by a single space.

## sample
1
1
1

</p>