#K81612. Common Elements Finder

    ID: 35793 Type: Default 1000ms 256MiB

Common Elements Finder

Common Elements Finder

You are given two lists of integers. Your task is to find the common elements between the two lists without duplicates and output them in ascending order.

In mathematical terms, if the two lists represent sets \(A\) and \(B\), then you need to output the sorted elements of \(A \cap B\).

If there are no common elements, output an empty line.

inputFormat

The input is read from standard input and consists of two lines:

  • The first line contains the integers of the first list separated by spaces.
  • The second line contains the integers of the second list separated by spaces.

outputFormat

Output the common elements in a single line, sorted in ascending order and separated by a single space. If there are no common elements, output an empty line.

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