80分,第二个点
查看原帖
80分,第二个点
1299558
plk5418楼主2025/1/16 13:30
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, x;
	string a;
	string y;
	cin >> n;
	cin >> a;
	for(int i = 1; i <= n; i++){
		cin >> x;
		if(x == 1){
			cin >> y;
			a += y;
			cout << a << "\n";
		}
		else if(x == 2){
			int b, c;
			cin >> b >> c;
			a = a.substr(b, c);
			cout << a << "\n";
		}
		else if(x == 3){
			int b;
			cin >> b >> y;
			cout << a.insert(b, y) << "\n";
		}
		else if(x == 4){
			cin >> y;
			if(a.find(y) < a.size()) cout << a.find(y) << "\n";
			else cout << -1;
		}
	}
    return 0;
}

2025/1/16 13:30
加载中...