#94. 数组元素左移一位

    ID: 94 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatArray-2gesp3一维数组循环结构

数组元素左移一位

Left Shift Array

Background

Congcong is learning about array operations. He encountered an interesting problem that requires a specific transformation on an array.

Problem Description

Return an array that is "left shifted" by one. Specifically, the first element of the array moves to the end of the array, and all other elements shift one position to the left. For example, if the original array is {6,2,5,3}\{6, 2, 5, 3\}, the left-shifted array will be {2,5,3,6}\{2, 5, 3, 6\}. You may modify and return the given array, or return a new array.

Input Format

The input is given from standard input in the following format.

The input consists of a single line representing an array. The array is formatted as [element1 element2 ... elementN], where elements are separated by spaces.

Output Format

The output is printed to standard output in the following format.

The output consists of a single line representing the left-shifted array. The array is formatted as [element1, element2, ..., elementN], where elements are separated by commas and spaces.

Sample

[6 2 5 3]
[2, 5, 3, 6]
[1 2]
[2, 1]
[1]
[1]

Sample Explanation

For the first sample, the input array is [6 2 5 3]. The element 66, which is the first element, is moved to the end of the array. The remaining elements 2,5,32, 5, 3 shift one position to the left, forming the new array [2, 5, 3, 6].

Constraints

Time limit: 11 second per test case. Memory limit: 10241024 KiB per test case.