求帮忙
查看原帖
求帮忙
1149981
22mengqiche楼主2024/8/13 20:28
#include<bits/stdc++.h>
using namespace std;
int n,num;
string str,srstr;
int a,b;
int main(){
    cin>>n>>str;
    for(int i = 0;i < n;i++){
        cin>>num;
        if(num == 1){
            cin>>srstr;
            str = str+srstr;
            cout<<str<<endl;
        }
        if(num == 2){
            cin>>a>>b;
            str = str.substr(a,b);
            cout<<str<<endl;
        }
        if(num == 3){
            cin>>a>>srstr;
            str.insert(a,srstr);
            cout<<str<<endl;
        }
        if(num == 4){
            cin>>srstr;
            cout<<str.find(srstr)<<endl;
        }
    }
}
2024/8/13 20:28
加载中...