#K94382. Set Intersection
Set Intersection
Set Intersection
You are given two sets of integers represented as lists. Each list contains integers in the range \(-50 \leq x \leq 50\). Your task is to compute the intersection of these two sets and output the resulting set as a sorted list in ascending order. If there are no common elements between the two sets, output an empty line.
Note: Even if the input lists contain duplicate values, treat them as sets (i.e. ignore duplicates) when computing the intersection.
Example:
Input: 1 2 3 4 5 4 5 6 7 8</p>Output: 4 5
inputFormat
The input consists of two lines:
- The first line contains space-separated integers representing the first set. If the line is empty, the set is considered empty.
- The second line contains space-separated integers representing the second set. Similarly, an empty line denotes an empty set.
outputFormat
Output a single line containing the sorted intersection of the two sets with each number separated by a space. If there is no intersection, output an empty line.
## sample1 2 3 4 5
4 5 6 7 8
4 5