#C5724. Find Common Elements in Two Lists
Find Common Elements in Two Lists
Find Common Elements in Two Lists
Given two lists of integers, your task is to find the integers that are common to both lists. The resulting list should have no duplicate elements and must be output in ascending order. If there are no common elements, output an empty line.
For example, if the first list is 1 2 2 3
and the second list is 3 3 4 4 2
, the common elements are 2
and 3
.
Note: Any formulas used in the explanation (if necessary) should be written in LaTeX format.
inputFormat
The input consists of two lines:
- The first line contains a list of space-separated integers representing the first list. An empty line represents an empty list.
- The second line contains a list of space-separated integers representing the second list. An empty line represents an empty list.
outputFormat
Output the common integers in ascending order as space-separated values on a single line. If there are no common integers, output an empty line.
## sample1 2 2 3
3 3 4 4 2
2 3