#C5512. String Left Rotation

    ID: 49170 Type: Default 1000ms 256MiB

String Left Rotation

String Left Rotation

You are given a non-empty string S and an integer N. Your task is to perform a left rotation on the string S by moving the first character to the end of the string, and repeat this process exactly N times.

Note that performing a full rotation of the string (i.e. rotating by the length of the string) returns the original string. Therefore, you should use the effective number of rotations, which is computed as \(N \mod |S|\), where \(|S|\) is the length of the string.

For example, if \(S=\texttt{abcde}\) and \(N=3\), the rotated string is \(\texttt{deabc}\).

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  • The first line contains a non-empty string S.
  • The second line contains an integer N indicating the number of left rotations to apply.

outputFormat

Output to standard output (stdout) the string obtained after performing the left rotations on S.

## sample
abcde
3
deabc