#C12650. Unique Element Counter
Unique Element Counter
Unique Element Counter
You are given a list of n positive integers. Your task is to remove duplicates while preserving the order of first occurrence, and then output each unique integer paired with the count 1. Formally, if the input list is \( [a_1, a_2, \ldots, a_n] \), then you need to produce a list of tuples \( [(x, 1), \ldots] \) where each \( x \) appears only once in the order it first appears in the input.
Input Format: The first line contains an integer \( n \) representing the number of elements. The second line contains \( n \) integers separated by spaces.
Output Format: For each unique integer (in the order of their first occurrence), print a line containing the integer and the number 1, separated by a space.
inputFormat
The input consists of two lines:
1. The first line contains a single integer \( n \), the number of elements.
2. The second line contains \( n \) space-separated positive integers.
outputFormat
For each unique integer in the order of appearance, output a single line with two values: the integer and 1, separated by a space. If there are no numbers in the input (i.e. \( n=0 \)), output nothing.
## sample6
4 4 4 9 9 10
4 1
9 1
10 1
</p>