#94. 数组元素左移一位
数组元素左移一位
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 , the left-shifted array will be . 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 , which is the first element, is moved to the end of the array. The remaining elements shift one position to the left, forming the new array [2, 5, 3, 6].
Constraints
Time limit: second per test case. Memory limit: KiB per test case.