#26. 提取数组中间两元素

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

提取数组中间两元素

Extract Middle Two Elements

Background

In a world full of numbers, you often need to quickly locate key information from a series of data. Now, you need to find the two most central elements from an array.

Problem Description

Given an array of integers of even length, return a new array of length 22 containing the middle two elements from the original array. The original array will be of length 22 or more.

Input Format

Input is given from standard input in the following format.

An array of integers, with elements separated by spaces and enclosed in square brackets [].

Output Format

Output is printed to standard output in the following format.

An array of 22 integers, containing the middle two elements from the original array, with elements separated by a comma and space , and enclosed in square brackets [].

Sample

[1 2 3 4]
[2, 3]
[7 1 2 3 4 9]
[2, 3]
[1 2]
[1, 2]

Sample Explanation

For Sample 11, the array [1 2 3 4] has a length of 44. The two middle elements are at indices 11 and 22, which are 22 and 33. For Sample 22, the array [7 1 2 3 4 9] has a length of 66. The two middle elements are at indices 22 and 33, which are 22 and 33. For Sample 33, the array [1 2] has a length of 22. The two middle elements are at indices 00 and 11, which are 11 and 22.

Constraints

Time limit: 11 second, Memory limit: 10241024 KiB for each test case.