#C2839. Right String Rotation

    ID: 46199 Type: Default 1000ms 256MiB

Right String Rotation

Right String Rotation

You are given a string S consisting of lowercase letters and an integer N. Your task is to rotate the string to the right by N positions. In a right rotation, the last N characters of the string are moved to the beginning, while the remaining characters are shifted to the right.

Note that if N is greater than or equal to the length of the string L, you should use the formula \[ N_{effective} = N \mod L \] to determine the effective number of rotations.

Example:

Input: S = "abcdef", N = 2
Output: "efabcd"

inputFormat

The input is given via standard input (stdin) and consists of two lines:

  • The first line contains the string S (only lowercase letters).
  • The second line contains the integer N, the number of rotations.

outputFormat

Output the rotated string to standard output (stdout).

## sample
abcdef
2
efabcd