文章
83
粉丝
2
获赞
546
访问
24.9k
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string s;
while(cin >> s){
int n;
cin >> n;
while(n--){
string op;
cin >> op;
int type = op[0] - '0';
int i = op[1] - '0';
int len = op[2] - '0';
if(type == 0){
reverse(s.begin() + i, s.begin() + i + len);
}
else{
string t = op.substr(3);
s.replace(i, len, t);
}
cout << s << endl;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发