#C9785. Decode Rotated Message
Decode Rotated Message
Decode Rotated Message
You are given a string S consisting only of lowercase letters and an integer k. Your task is to decode the message by rotating the string to the left k times. In other words, you need to transform the string S into a new string by moving its first k characters to the end.
Formally, if S is of length n, then the decoded string is defined as:
[ \text{decoded}(S, k) = S[k \bmod n : n] ; + ; S[0 : k \bmod n] ]
For example, if S = "abcd" and k = 2, the decoded string is "cdab".
inputFormat
The first line of input contains a single integer T indicating the number of test cases. Each of the following T lines contains a test case with a string S and an integer k separated by a space.
Constraints:
- The string S consists only of lowercase English letters.
- k is a non-negative integer.
outputFormat
For each test case, output the decoded string on a new line.
## sample3
abcd 2
abcdef 3
xyz 10
cdab
defabc
yzx
</p>