#K39092. Right Rotation String

    ID: 26343 Type: Default 1000ms 256MiB

Right Rotation String

Right Rotation String

You are given a string s and a non‐negative integer r.

Your task is to rotate the string s to the right by r positions. More formally, if n is the length of the string, you must compute the rotation by taking the last r mod n characters and concatenating them with the first n - (r mod n) characters.

For example, if s = "abcde" and r = 1, then the rotated string is "eabcd".

It is guaranteed that the string is non-empty.

inputFormat

The first line of input contains an integer T representing the number of test cases. Each of the following T lines contains a test case with a string s and an integer r separated by whitespace.

You should read input from standard input (stdin).

outputFormat

For each test case, output the rotated string on a separate line. Write your output to standard output (stdout).

## sample
5
abcde 1
zxy 2
cba 3
abcdef 0
abcdef 6
eabcd

xyz cba abcdef abcdef

</p>