#K7716. Clean the Book Borrow Log
Clean the Book Borrow Log
Clean the Book Borrow Log
You are given a log of book borrowings with N entries. Some entries might be duplicates because the same book may have been borrowed more than once. Your task is to remove duplicate book IDs while preserving the order of their first occurrence.
More formally, given an integer \(N\) and a sequence of \(N\) integers \(a_1, a_2, \dots, a_N\), return a list \(b_1, b_2, \dots, b_k\) such that each \(b_i\) is unique and appears in the same order as in the original list. For example, if the input is:
[ 10\ 1;2;2;3;1;4;3;5;6;4 ]
the output should be:
[ 1;2;3;4;5;6 ]
Make sure your solution reads input from stdin
and writes output to stdout
.
inputFormat
The first line contains an integer \(N\) (the number of book IDs in the log). The second line contains \(N\) space-separated integers representing the book IDs.
outputFormat
Output the cleaned list of book IDs with duplicates removed. The IDs should be printed on one line separated by a single space. If there are no IDs, output an empty line.
## sample10
1 2 2 3 1 4 3 5 6 4
1 2 3 4 5 6
</p>