LearnPy Hub
← Iterators & Generators problems
Hard

Merge Sorted Streams

Write a generator merge(a, b) that takes two sorted iterators and yields all values in sorted order, reading only one value ahead from each. Read two sorted lines and print the merged sequence.

Input

Two lines of sorted integers.

Output

One line.

Sample 1

Input
1 4 9
2 3 10
Output
1 2 3 4 9 10

Sample 2

Input
5
1 2 3
Output
1 2 3 5
solution.py
Output appears here
Merge Sorted Streams · Python practice problem · LearnPy Hub