#16. 提取数组中间元素

    ID: 16 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatArray-1gesp3一维数组

提取数组中间元素

Extract Middle Elements

Background

Congcong is learning array operations and encountered an interesting small problem.

Problem Description

Given two integer arrays, aa and bb, each of length 33. Return a new array of length 22 containing the middle element of aa and the middle element of bb.

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 33 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 xx is the middle element of the first array and yy 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 aa is [1 2 3], and its middle element is 22. Array bb is [4 5 6], and its middle element is 55. Therefore, the new array returned is [2, 5].

Constraints

Time limit for each test case is 11 second, and memory limit is 10241024 KiB.