#C12689. Remove Duplicates from a List
Remove Duplicates from a List
Remove Duplicates from a List
Given a list of positive integers, your task is to remove duplicate elements while preserving the order of their first occurrence. In other words, when traversing the list from left to right, the first time you encounter a number it should be kept, and any subsequent occurrences should be removed.
Note: The input list may be empty. The input is provided via standard input (stdin) and the output should be printed to standard output (stdout). If a formula is required, use LaTeX format. For example, if you want to denote the number of elements, use \(n\).
Example:
Input: 5 1 2 3 2 1</p>Output: 1 2 3
inputFormat
The first line of input contains an integer \(n\) which represents the number of elements in the list. The second line contains \(n\) positive integers separated by spaces.
outputFormat
Output the deduplicated list, preserving the order of first occurrences. The numbers should be separated by a single space.
## sample5
1 2 3 2 1
1 2 3