#C3499. Cyclic Shift
Cyclic Shift
Cyclic Shift
Given a string s
and an integer n
, perform n
cyclic shifts on s
and output the resulting string. In each cyclic shift, the last character of the string is moved to the beginning. The effective number of shifts is computed using the formula \(n \mod |s|\), where \(|s|\) denotes the length of the string.
For example, if s = "abcde"
and n = 2
, the output will be deabc
.
inputFormat
The input consists of two lines. The first line contains the string s
. The second line contains an integer n
representing the number of cyclic shifts to perform.
outputFormat
Output the string after performing the cyclic shifts on s
.
abcde
2
deabc