~/algor $ cat problems/massiv-ongga-siklik-surish
Cyclic shift right by 1
Easy
1000 ms
128 MB
31%
A positive integer $n$ and an array of $n$ integers are given. Cyclically shift the array elements by $1$ position to the right (the last element moves to the first place) and print the resulting array.
Input
The first line contains a positive integer $n$. The second line contains $n$ integers separated by spaces.
Output
One line with $n$ integers separated by spaces.
Note
$1 \le n \le 1000$
$-10^{9} \le a_{i} \le 10^{9}$
Examples
Input #1
5 10 20 30 40 50
Output #1
50 10 20 30 40
Input #2
3 1 2 3
Output #2
3 1 2