#K10801. Unique Numbers in Series
Unique Numbers in Series
Unique Numbers in Series
You are given T series of numbers. For each series, you need to determine its unique numbers. A unique number is defined as a number that appears exactly once in the series. The order of output must follow the order in which the numbers were first encountered.
If a series does not contain any unique number, print None
as the result for that series.
Mathematically, a number x is unique in a series S if and only if $$count(x)=1$$, where $$count(x)$$ is the number of times x appears in S.
Example:
Input: 3 7 4 5 6 5 4 7 8 5 1 2 2 3 4 6 1 2 3 1 2 3</p>Output: 6 7 8 1 3 4 None
inputFormat
The input is given via standard input (stdin) and follows the format below:
- The first line contains an integer
T
, the number of series. - For each series, the first number is an integer
N
which indicates the number of elements in the series, followed byN
integers separated by spaces.
For example:
3 7 4 5 6 5 4 7 8 5 1 2 2 3 4 6 1 2 3 1 2 3
outputFormat
For each series, output a line containing the unique numbers (i.e. numbers that appear exactly once) separated by a single space, in the order they first occur. If there are no unique numbers in a series, output None
on that line.
For example, corresponding to the sample input above, the output should be:
6 7 8 1 3 4 None## sample
3
7
4 5 6 5 4 7 8
5
1 2 2 3 4
6
1 2 3 1 2 3
6 7 8
1 3 4
None
</p>