#C14425. Rotate List to the Left

    ID: 44073 Type: Default 1000ms 256MiB

Rotate List to the Left

Rotate List to the Left

Given a list of integers and an integer (k), rotate the list to the left by (k) positions. The rotated list is formed by moving the first (k \mod n) elements to the end of the list, where (n) is the number of elements. This operation appears in many practical applications and is especially important in data manipulation tasks. Your task is to implement this rotation operation efficiently.

inputFormat

The input is given via standard input. The first line contains an integer (n) representing the number of elements in the list. The second line contains (n) space-separated integers representing the elements of the list (if (n = 0), the line will be empty). The third line contains an integer (k) which is the number of positions to rotate the list to the left.

outputFormat

Output the rotated list as a space-separated sequence of integers in a single line. If the list is empty, output an empty line.## sample

5
1 2 3 4 5
2
3 4 5 1 2

</p>