#K44752. Extract Unique Elements in Order

    ID: 27601 Type: Default 1000ms 256MiB

Extract Unique Elements in Order

Extract Unique Elements in Order

Given an array of integers, your task is to output the unique elements in the order they first appeared. For an input array A=[a1,a2,,an]A = [a_1, a_2, \ldots, a_n], you need to find the sequence BB such that each element in BB appears only once and in the order of their appearance in AA.

For example, if the input array is [3, 4, 3, 2, 4, 5], the output should be [3, 4, 2, 5].

inputFormat

The first line of input contains a single integer NN, denoting the number of elements in the array. The second line contains NN space-separated integers representing the array elements.

outputFormat

Output the unique elements in the order they appear in the array. Print the numbers separated by a space.## sample

6
3 4 3 2 4 5
3 4 2 5

</p>