模拟即可~~~
#include<iostream>
#include<string>
using namespace std;
string mode;
string t;
int n;
int main(){
cin>>mode;
cin>>n;
while(n--){
int l,r;
string op;
cin>>op;
// cout<<op<<endl;
if(op=="COPY"){
cin>>l>>r;
t=mode.substr(l,r-l+1);
}
else if(op=="CUT"){
// cout<<"xxx"<<endl;
string temp="";
cin>>l>>r;
// cout<<l<<" "<<r<<endl;
string x="";
for(int i=0;i<mode.size();i++){
if(i>=l&&i<=r){
x+=mode[i];
continue;
}
temp+=mode[i];
}
mode=temp;
t=x;
}
else{
int k;
cin>>k;
string s1=mode.substr(0,k+1);
string s2=mode.substr(k+1);
for(int j=0;j<t.size();j++){
s1+=t[j];
}
s1+=s2;
mode=s1;
}
cout<<mode<<endl;
}
return 0;
}