#C13607. Unique Elements
Unique Elements
Unique Elements
Given a list of integers, your task is to extract and output only those integers that appear exactly once in the list, while preserving their order of first occurrence.
More formally, if the input list is \(A = [a_1, a_2, \dots, a_n]\), you need to construct a list \(B\) where an element \(a_i\) is included in \(B\) if and only if \(a_i\) appears exactly once in \(A\). There is no need to sort the output; simply retain the original relative order.
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 array.
- The second line contains \(n\) space-separated integers.
outputFormat
Print a single line to standard output (stdout) containing the elements that appear exactly once, in the same order as they appear in the input, separated by a single space. If no element qualifies, output an empty line.
## sample7
4 5 7 8 4 5 9
7 8 9