#C10056. Unique Elements Extraction

    ID: 39219 Type: Default 1000ms 256MiB

Unique Elements Extraction

Unique Elements Extraction

You are given an array of integers. Your task is to remove all duplicate elements from the array while preserving the order in which they first appear. In other words, from the original array, filter out repeated occurrences so that each element appears only once, and output the resulting list.

For instance, given the array \( [1, 2, 2, 3, 4, 4, 5, 1] \), the answer should be \( [1, 2, 3, 4, 5] \).

Input Format: The input is given from stdin.

Output Format: The output should be printed on stdout.

inputFormat

The first line contains an integer (n), representing the number of elements in the array. The second line contains (n) space-separated integers.

outputFormat

Print the unique elements of the array in the order of their first appearance, separated by a single space. If the array is empty, print nothing.## sample

8
1 2 2 3 4 4 5 1
1 2 3 4 5

</p>