Problem list
Log in
#r03221 · Online Judge > GoldOJ

Remove Consecutive Duplicates

Bronze III 2.0 s 256 MB

Scanning the $N$ integers left to right, collapse each run of consecutive equal values into a single copy. Print the remaining integers in order, space-separated.

Input

Line 1: $N$ ($1 \le N \le 1000$). Line 2: $N$ integers in $[-10000, 10000]$.

Output

Print the sequence with consecutive duplicates removed.

Example 1

Input
8
1 2 2 3 3 3 4 2
Output
1 2 3 4 2
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code