#d2734. 子串的循环挪动
子串的循环挪动
Cyclic Shift of a Substring
Problem Description
You are given a string , and you must perform tasks. Each task gives two indices and an integer (the string is -indexed), meaning that you cyclically shift the substring exactly times. Execute the given tasks one by one, in order.
The cyclic shift operation moves the last character to the first position, and shifts every other character one position to the right.
For example, suppose is abacaba. If the first task is , the answer becomes abbacaa. Then if the next task is , we obtain baabcaa.
Input Format
The first line contains a string consisting only of lowercase English letters.
The second line contains an integer , the number of tasks.
Each of the next lines contains three integers .
Output Format
Output the final string after performing all tasks.
Sample Input
abacaba
2
3 6 1
1 4 2
Sample Output
baabcaa
Constraints
For all data: ( denotes the length of ), , , and .