题解 | #查找#
查找
https://www.nowcoder.com/practice/a988eda518f242c29009f8620f654ede
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
	string s;
    cin >> s;
    int n;
    cin>>n;
    while(n--){
    	string cmd;
    	cin>>cmd;
    	int type = cmd[0] - '0';
    	int i = cmd[1] - '0';
    	int len = cmd[2] - '0';
    	if(type == 0){
    		reverse(s.begin()+i,s.begin()+i+len);
    		cout<<s<<endl;
		}else if(type == 1){
			s.replace(i,len,cmd.substr(3));
			cout<<s<<endl;
		}
	}     
}

 投递滴滴等公司10个岗位
投递滴滴等公司10个岗位 查看12道真题和解析
查看12道真题和解析