#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
string str;
int n;
string demand;
while(cin>>str){
scanf("%d",&n);
for(int i = 1;i<=n;i++)
{
cin>>demand;
if(demand[0]=='0')//翻转
{
int start = demand[1]-'0';
int len = demand[2]-'0';
reverse(str.begin()+start,str.begin()+start+len);
cout<<str<<endl;
}else if(demand[0]=='1')//替换
{
int start = demand[1]-'0';
int len = demand[2]-'0';
string aa = demand.substr(3,len);
str = str.replace(start,len,aa);
cout<<str<<endl;
}
}
}
}
北京邮电1177,replace和reverse的用法
最新推荐文章于 2022-03-02 17:08:00 发布