#C11208. Odd Occurrences
Odd Occurrences
Odd Occurrences
Given a list of integers, find and return the list of distinct elements that appear an odd number of times. The output should maintain the order in which these elements appear for the first time in the input.
More formally, for each element (a) in the list, if its frequency (f(a)) satisfies (f(a) \bmod 2 = 1), then it should be included (only once) in the output in the same order as its first occurrence. Otherwise, ignore it.
inputFormat
The input is provided via stdin. The first line contains an integer (n) ((0 \le n \le 10^5)), representing the number of elements in the list. The second line contains (n) space-separated integers.
outputFormat
Output via stdout the distinct integers that occur an odd number of times, in the order of their first appearance. The numbers should be separated by a single space. If no such number exists, output an empty line.## sample
7
1 2 3 2 3 1 3
3