Akshya is given a list of N integers. Each number in the list appears exactly for one number. help akshya by identifying the numbers which appeared exactly once in the list.
Input
The input contains a single-line comma-separated integers.
Output
The output contains a single-line comma-separated integers.
Sample Input1
8,9,5,8,5,6
Sample Output1
9,6
Sample Input2
1,2,3,4,5,1,2,3,4
Sample Output2
5
numbers = [int(i) for i in input().split(",")]
once = []
for i in range(len(numbers)):
if numbers[i] not in numbers[:i] + numbers[i+1:]:
once.append(numbers[i])
print(*once, sep=",")
Comments
Leave a comment