#C6154. Cyclic String Shift

    ID: 49883 Type: Default 1000ms 256MiB

Cyclic String Shift

Cyclic String Shift

Given a string ( s ) consisting of lowercase letters and an integer ( n ), perform a right cyclic shift on the string ( s ) by ( n ) positions. In a right cyclic shift, the last ( n ) characters of the string are moved to the beginning while the remaining characters are shifted right. Note that if ( n ) is greater than the length of ( s ), you should use the effective shift ( n \mod |s| ) (here ( |s| ) denotes the length of the string).

Example: For the input string "hello" and ( n=1 ), the result is "ohell".

inputFormat

The input consists of two lines. The first line contains the string ( s ) (a non-empty string of lowercase letters). The second line contains an integer ( n ) representing the number of right cyclic shifts to perform.

outputFormat

Output the resulting string after performing the right cyclic shift on ( s ) by ( n ) positions.## sample

hello
1
ohell