#C14103. Merge and Sort Two Integer Lists
Merge and Sort Two Integer Lists
Merge and Sort Two Integer Lists
Given two lists of integers, you are required to merge them into a single list and then sort the resulting list in ascending order.
In mathematical notation, if you are given two sequences: (A = [a_1, a_2, \dots, a_n]) and (B = [b_1, b_2, \dots, b_m]), the merged list (C) is obtained by concatenating the two lists, i.e., (C = A \cup B), and then reordering the elements such that (c_1 \le c_2 \le \dots \le c_{n+m}).
Your implementation should read input from standard input (stdin) and write the sorted merged list to standard output (stdout) with each number separated by a single space.
inputFormat
The input consists of four lines:
1. The first line contains an integer (n), representing the number of elements in the first list.
2. The second line contains (n) space-separated integers.
3. The third line contains an integer (m), representing the number of elements in the second list.
4. The fourth line contains (m) space-separated integers.
outputFormat
Output a single line containing all the integers from both lists merged and sorted in ascending order. Each integer should be separated by a single space.## sample
3
1 4 6
3
2 5 3
1 2 3 4 5 6