#K66052. Right Rotation of a String

    ID: 32334 Type: Default 1000ms 256MiB

Right Rotation of a String

Right Rotation of a String

Given a string s and an integer k, perform a right rotation on the string by k positions. In other words, move the last k characters of the string to the beginning. The rotation is defined mathematically as follows:

$$ s = s_{1}s_{2}\ldots s_{n}, \quad \text{answer} = s_{n-k+1}\ldots s_{n} s_{1}\ldots s_{n-k} $$

If k is greater than the length of the string, you should rotate the string by k \mod n positions, where n is the length of the string. Handle edge cases such as an empty string or a single-character string appropriately.

inputFormat

The input consists of two lines:

  1. The first line contains the string s.
  2. The second line contains an integer k, representing the number of positions to rotate to the right.

outputFormat

Output the rotated string as a single line.

## sample
hello
2
lohel