Rotate the Array by K
Rotate an array to the left by K positions.
Input format
The first line has N. The second line has N integers. The third line has one integer K (K >= 0).
Output format
Print the array after rotating it left by K positions (the first K elements move to the end).
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
5
1 2 3 4 5
2Expected output
3 4 5 1 2Example 2
Input
5
1 2 3 4 5
0Expected output
1 2 3 4 5