Three sequences of integers are given, each already sorted in ascending order.
Print the sequence obtained by merging all three so that the result is also in ascending order.
The required algorithm is a generalisation of the two-index merge: use three indices i, j, k, one for each sequence, and at each step print the minimum of a[i], b[j] and c[k], advancing the index that provided the minimum. When a sequence is exhausted, treat its current value as +infinity.