#K59152. Symmetric Difference of Two Lists

    ID: 30801 Type: Default 1000ms 256MiB

Symmetric Difference of Two Lists

Symmetric Difference of Two Lists

Given two lists of integers, your task is to compute the symmetric difference of the two lists. Mathematically, the symmetric difference of two sets \(A\) and \(B\) is defined as \(A \triangle B = (A \cup B) \setminus (A \cap B)\). In this problem, you should consider the unique elements in each list and then output their symmetric difference in sorted order.

If the symmetric difference is empty, simply output an empty line.

inputFormat

The input is provided via standard input (stdin) and consists of three lines:

  • The first line contains two integers \(m\) and \(n\), the sizes of the first and second list respectively.
  • The second line contains \(m\) integers, the elements of the first list. If \(m = 0\), this line will be empty.
  • The third line contains \(n\) integers, the elements of the second list. If \(n = 0\), this line will be empty.

outputFormat

Output the sorted symmetric difference of the two lists. The numbers should be separated by a single space. If there are no elements in the symmetric difference, output an empty line.

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