def shift(l,r,k,s):
len = r-l+1
shift = k%len
end = r-shift+1
out = s[:l]+s[end:r+1]+s[l:end]+s[r+1:]
return out
s = input()
m = int(input())
for _ in range(m):
l,r,k = tuple(map(int,input().split()))
s = shift(l-1,r-1,k,s)
print(s)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll t, l, r, k;
int main()
{
char s[11000], ss[11000];
scanf("%s", &s);
scanf("%lld", &t);
while(t--)
{
scanf("%lld%lld%lld", &l, &r, &k);
ll x = 0;
for(ll i = l-1; i <= r-1; i++)
ss[x++] = s[i];
for(ll i = 0; i < x; i++)
s[l - 1 + (i + k) % x] = ss[i];
}
printf("%s\n", s);
return 0;
}
2144. Minimum Cost of Buying Candies With Discount | Non empty subsets |
1630A - And Matching | 1630B - Range and Partition |
1630C - Paint the Middle | 1630D - Flipping Range |
1328A - Divisibility Problem | 339A - Helpful Maths |
4A - Watermelon | 476A - Dreamoon and Stairs |
1409A - Yet Another Two Integers Problem | 977A - Wrong Subtraction |
263A - Beautiful Matrix | 180C - Letter |
151A - Soft Drinking | 1352A - Sum of Round Numbers |
281A - Word Capitalization | 1646A - Square Counting |
266A - Stones on the Table | 61A - Ultra-Fast Mathematician |
148A - Insomnia cure | 1650A - Deletions of Two Adjacent Letters |
1512A - Spy Detected | 282A - Bit++ |
69A - Young Physicist | 1651A - Playoff |
734A - Anton and Danik | 1300B - Assigning to Classes |
1647A - Madoka and Math Dad | 710A - King Moves |