#C10681. Unique Elements in Order
Unique Elements in Order
Unique Elements in Order
You are given a list of integers. Your task is to remove the duplicate numbers while preserving the order of their first occurrence. In other words, you have to generate a list \(L'\) from the given list \(L\), where each element appears only once and in the same order as they appeared in \(L\).
Example:
Input: 7 1 2 2 3 4 4 5 Output: 1 2 3 4 5
Note: The order of elements is preserved, meaning that if an element appears multiple times, only its first occurrence in \(L\) is kept in \(L'\).
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \(n\) representing the number of elements in the list.
- The second line contains \(n\) space-separated integers.
outputFormat
Output the list of unique elements in a single line, separated by a single space. If the list is empty, output an empty line.
## sample5
1 2 3 4 5
1 2 3 4 5