#C13011. Finding the Intersection of Two Lists

    ID: 42503 Type: Default 1000ms 256MiB

Finding the Intersection of Two Lists

Finding the Intersection of Two Lists

You are given two lists of integers. Your task is to determine the intersection of these two lists, meaning the elements that appear in both lists. The result should be a sorted list (in ascending order) of unique common elements. Formally, given two sets (A) and (B), you need to compute (A \cap B) and output the elements in sorted order.

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. An empty line indicates an empty list.

outputFormat

Output the common unique integers in ascending order, separated by a single space. If there are no common elements, output an empty line.## sample

1 2 3 4
3 4 5 6
3 4