#include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <string> using namespace std; int main() { string s; int n; while(cin>>s){ cin>>n; while(n--) { string s1; cin>>s1; char c = s1[0]; if(c=='0'){ int begin = s1[1]-'0'; int end = begin + (s1[2]-'0'); reverse(&s[begin],&s[end]); cout<<s<<endl; // cout<<begin<<" "<<end<<endl; } else { int begin = s1[1]-'0'; int end = begin + (s1[2]-'0'); string sub = s1.substr(3); string sub1 = s.substr(0,begin); string sub2 = s.substr(end); s = sub1 + sub + sub2; // for(int i=begin;i<end;i++) // { // s[i] = s1[i - begin +3]; // } cout<<s<<endl; } } } } // 64 位输出请用 printf("%lld")