#C12784. Intersection of Two Arrays
Intersection of Two Arrays
Intersection of Two Arrays
Given two lists of integers, your task is to compute the intersection of these two lists. The intersection should contain only the elements that appear in both lists, with duplicates removed, and the output must be sorted in ascending order.
If there is no intersection, output an empty line.
inputFormat
The input consists of four lines:
- The first line contains a single integer n, the number of elements in the first list.
- The second line contains n space-separated integers representing the first list.
- The third line contains a single integer m, the number of elements in the second list.
- The fourth line contains m space-separated integers representing the second list.
outputFormat
Output a single line consisting of the intersection of the two arrays in ascending order. The numbers must be separated by a single space. If the intersection is empty, output an empty line.
## sample5
1 3 5 7 9
4
5 7 11 13
5 7
</p>