为啥才40啊,求助
查看原帖
为啥才40啊,求助
1330366
QQQcainiao666楼主2024/9/29 21:36
#include<bits/stdc++.h>
using namespace std;

int main(){
	int q;
	string str;
	cin>>q;
	cin>>str;
	while(q--){
		int n;
		cin>>n;
		if(n==1){
			string str2;
			cin>>str2;
			str=str+str2;
			cout<<str<<endl;
		}
		if(n==2){
			int s,e;
			cin>>s>>e;
			str=str.substr(s,e);
			cout<<str<<endl;
		}
		if(n==3){
			int s;
			string tmp;
			cin>>s>>tmp;
			str=str.insert(s,tmp);
			cout<<str<<endl;
		}
		if(n==4){
			string tmp;
			cin>>tmp;
			if(str.find(tmp)){
				cout<<str.find(tmp)<<endl;
			}else{
				cout<<"-1"<<endl;
			}
		}
	}
	return 0;
}
2024/9/29 21:36
加载中...