#C12109. Unique Common Elements
Unique Common Elements
Unique Common Elements
Given two lists of integers, your task is to find the common elements that appear exactly once in each list. In other words, a number is considered common if it appears exactly one time in the first list and exactly one time in the second list. You are not allowed to use built-in set operations. The order of the output numbers does not matter.
For example, if the first list is [1, 2, 3, 4, 5] and the second list is [4, 5, 6, 7, 8], then the output should be:
$$Output: 4\ 5$$
inputFormat
The input consists of two lines provided via standard input.
The first line contains space-separated integers representing the first list.
The second line contains space-separated integers representing the second list.
outputFormat
Output the common unique elements (i.e. numbers that appear exactly once in each list) as space-separated integers in a single line. If no such elements exist, print an empty line.## sample
1 2 3 4 5
4 5 6 7 8
4 5