#C7298. Rotate List

    ID: 51153 Type: Default 1000ms 256MiB

Rotate List

Rotate List

You are given a list of integers and a non-negative integer steps. Your task is to rotate the list to the right by steps positions. If steps is greater than the size of the list, only the effective number of rotations is performed. Note that the effective number of rotations can be computed using the equation $$k = steps \mod n$$, where \(n\) is the number of elements in the list.

Example:

Input:  1 2 3 4 5
       2
Output: 4 5 1 2 3

Implement the function to perform this rotation and output the rotated list with space-separated integers.

inputFormat

The input consists of two lines:

  • The first line contains space-separated integers representing the list.
  • The second line contains an integer steps that indicates the number of positions to rotate the list.

outputFormat

Print a single line containing the rotated list as space-separated integers.

## sample
1 2 3 4 5
2
4 5 1 2 3