#K37002. String Rotation

    ID: 25879 Type: Default 1000ms 256MiB

String Rotation

String Rotation

You are given a string \(S\) and an integer \(N\). Your task is to rotate the string to the right by \(N\) characters. If \(N\) is greater than the length of the string, perform the rotation modulo the length of \(S\). In other words, you need to compute the rotated string, which is the concatenation of the last \(N \bmod |S|\) characters of \(S\) with the remaining beginning part.

For example, given \(S = \texttt{abcdef}\) and \(N = 2\), the result is \(\texttt{efabcd}\).

Note that if \(S\) is empty, the result is an empty string.

inputFormat

The input consists of two lines:

  • The first line contains the string \(S\).
  • The second line contains the integer \(N\).

Read the input from standard input (stdin).

outputFormat

Output a single line containing the rotated string result. Write the output to standard output (stdout).

## sample
abcdef
2
efabcd