Merging Two Sales Reports
Fenwick Retail runs two regions, and each region's manager files a day's sales figures separately. Head office publishes a single running strip of the day's figures for the wall screen, with region A's figures ahead of region B's, each region's own order left exactly as filed. The two regions rarely file the same number of figures, and nothing is dropped on the way in: if both regions happen to file the same amount, that amount appears on the strip twice.
Task: Print the two regions' figures as one strip.
Input
Four lines. The first holds an integer n, the count of figures from region A; the second holds A's n figures separated by single spaces. The third holds an integer m, the count from region B; the fourth holds B's m figures.
Output
One line holding all n + m figures separated by single spaces — region A's first, in the order filed, then region B's, in the order filed. Write each as a plain integer.
Example:
Input:
2
10 20
3
5 15 25
Output:
10 20 5 15 25
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in