#C10896. Unique Elements from Two Lists

    ID: 40151 Type: Default 1000ms 256MiB

Unique Elements from Two Lists

Unique Elements from Two Lists

You are given two lists of integers. Your task is to find the elements that are unique to each list. In other words, you need to output the symmetric difference of the two lists.

The symmetric difference between two sets \(A\) and \(B\) is defined as \[ A \triangle B = (A \setminus B) \cup (B \setminus A) \] This means you should remove any elements that appear in both lists.

Example: For the input lists [1, 2, 3, 4] and [3, 4, 5, 6], the unique elements are [1, 2, 5, 6].

Note that the input lists might contain duplicate elements. However, the uniqueness is determined based on the distinct values present.

inputFormat

The input consists of two lines:

  • The first line contains space-separated integers representing the first list.
  • The second line contains space-separated integers representing the second list.

Both lists will contain at least one integer.

outputFormat

Output a single line containing the unique elements (i.e. the symmetric difference) in ascending order, separated by a single space.

## sample
1 2 3 4
3 4 5 6
1 2 5 6