#C14056. Rotate List
Rotate List
Rotate List
You are given a list of integers and an integer k. Your task is to rotate the list to the right by k steps. This means that the last k elements of the list are moved to the beginning, and the remaining elements are shifted rightwards.
If k is greater than the length of the list, you should use the effective number of rotations computed as \(k \% n\) (where \(n\) is the number of elements in the list). The input is provided via standard input (stdin) and the result should be printed to standard output (stdout) with the elements separated by spaces.
inputFormat
The input consists of two lines:
- The first line contains space-separated integers representing the list. If the list is empty, the line may be empty.
- The second line contains an integer k indicating the number of rotation steps.
outputFormat
Output the rotated list as space-separated integers. Do not include extra spaces at the beginning or the end.
## sample1 2 3 4 5 6 7
3
5 6 7 1 2 3 4