#C14723. Remove Adjacent Duplicates

    ID: 44404 Type: Default 1000ms 256MiB

Remove Adjacent Duplicates

Remove Adjacent Duplicates

Given a sequence of integers, remove all the adjacent duplicates. In other words, for a list \(A = [a_1, a_2, \dots, a_n]\), create a new list \(B\) by retaining only the first occurrence among consecutive duplicates. For instance, if \( A = [1, 2, 2, 3, 4, 4, 5]\) then the result is \( B = [1, 2, 3, 4, 5]\).

The program should read input from standard input (stdin) and output the processed list to standard output (stdout). When printing the result, the integers should be separated by a single space. If there are no elements in the list, output an empty line.

inputFormat

Input Format: A single line that contains zero or more space-separated integers. The list can be empty.

outputFormat

Output Format: A single line with the elements of the resulting list (after removing adjacent duplicates) separated by a single space. If the list is empty, output an empty line.

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