#K75842. Rotate Array

    ID: 34509 Type: Default 1000ms 256MiB

Rotate Array

Rotate Array

Given an array of n integers, your task is to rotate the array to the right by one position. This means that the last element of the array becomes the first element and all other elements shift one position to the right.

Example: If the input array is [1, 2, 3, 4, 5], the output after rotation will be [5, 1, 2, 3, 4].

You are required to read the input from stdin and print the output to stdout.

Note: The problem guarantees that the number of integers provided in the array is equal to n.

inputFormat

The first line of input contains an integer n, which is the number of elements in the array. The second line contains n space-separated integers representing the array.

outputFormat

Output the rotated array as space-separated integers in one line, where the array has been rotated to the right by one position.## sample

1
1
1