#16. 提取数组中间元素
提取数组中间元素
Extract Middle Elements
Background
Congcong is learning array operations and encountered an interesting small problem.
Problem Description
Given two integer arrays, and , each of length . Return a new array of length containing the middle element of and the middle element of .
Input Format
Input is given from standard input in the following format.
The input consists of a single line containing two arrays. Each array is enclosed by square brackets
[and], and contains space-separated integers. The two arrays are also separated by a single space. For example:[a1 a2 a3] [b1 b2 b3].
Output Format
Output to standard output in the following format.
A new array containing two integers, formatted as
[x, y], where is the middle element of the first array and is the middle element of the second array.
Sample
[1 2 3] [4 5 6]
[2, 5]
[7 7 7] [3 8 0]
[7, 8]
[5 2 9] [1 4 5]
[2, 4]
Sample Explanation
For the first sample, array is [1 2 3], and its middle element is . Array is [4 5 6], and its middle element is . Therefore, the new array returned is [2, 5].
Constraints
Time limit for each test case is second, and memory limit is KiB.