#K76452. Remove Duplicates from Session Log
Remove Duplicates from Session Log
Remove Duplicates from Session Log
You are given a list of integers representing session IDs logged in order. Your task is to remove duplicate session IDs while preserving the order of their first appearances.
Formally, given a list \(A = [a_1, a_2, \dots, a_n]\), you need to construct a list \(B\) such that each element in \(B\) appears only once and in the same order as their first occurrence in \(A\).
Example:
Input: 10 1 2 3 4 2 1 5 6 7 3 Output: 1 2 3 4 5 6 7
The input and output are handled through standard input (stdin) and standard output (stdout).
inputFormat
The first line contains an integer \(n\) (\(0 \le n \le 10^5\)) representing the number of session IDs. The second line contains \(n\) space-separated integers.
outputFormat
Output the session IDs after removing duplicates, preserving the order of their first appearance. The IDs should be printed in one line separated by spaces. If the list is empty, print nothing.
## sample10
1 2 3 4 2 1 5 6 7 3
1 2 3 4 5 6 7