#C426. Unique Elements Extraction
Unique Elements Extraction
Unique Elements Extraction
You are given a list of integers. Your task is to remove all duplicate elements while preserving the order of the first occurrence. In other words, output the sequence of unique integers in the same order as they first appear in the input.
The input is provided via standard input (stdin) and the output should be produced on standard output (stdout). The first line of input contains an integer \(n\) indicating the number of elements. The second line contains \(n\) integers separated by spaces. If \(n = 0\), output an empty line.
Example:
Input: 8 1 2 2 3 4 4 5 1</p>Output: 1 2 3 4 5
Make sure that your solution correctly handles all edge cases, including an empty list.
inputFormat
The input is given in the following format:
- The first line contains a single integer \(n\) (\(0 \leq n \leq 10^5\)) representing the number of elements in the list.
- The second line contains \(n\) integers separated by spaces.
outputFormat
Output a single line containing the unique elements extracted from the list, in the order of their first occurrence. The numbers should be separated by a single space. If the list is empty, output an empty line.
## sample0