#C14396. Merge and Sort Unique Lists

    ID: 44040 Type: Default 1000ms 256MiB

Merge and Sort Unique Lists

Merge and Sort Unique Lists

You are given two sorted lists of integers. Your task is to merge these two lists into a single sorted list that contains no duplicate elements. In other words, remove any repeated values and output the final list in increasing order.

The input is provided via standard input with two lines, and the output should be printed to standard output. Use efficient algorithms to handle the merging and duplicate removal process.

Note: If one or both of the input lists are empty, the output should reflect the merged result accordingly.

inputFormat

The input consists of exactly two lines:

  • The first line contains zero or more integers separated by spaces, representing the first sorted list.
  • The second line contains zero or more integers separated by spaces, representing the second sorted list.

If a list is empty, the corresponding line will be blank.

outputFormat

Output a single line containing the merged sorted list of unique integers. The numbers should be separated by a single space. If the merged list is empty, output a blank line.

## sample
1 3 4 5
2 3 6 7
1 2 3 4 5 6 7