文章
211
粉丝
1
获赞
1178
访问
75.0k
#include<bits/stdc++.h>
using namespace std;
int main(){
string str;
while(cin >> str){
int n;
cin >> n;
while(n--){
string tag;
cin >> tag;
if(tag[0] == '0'){
int start = tag[1] - '0';
int len = tag[2] - '0';
reverse(str.begin() + start, str.begin() + start + len);
cout << str << endl;
}else if(tag[0] == '1'){
int start = tag[1] - '0';
int len = tag[2] - '0';
string replacement = tag.substr(3); // 从第4位开始到最后
str.replace(start, len, replacement);
cout << str << endl;
}
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发