nanaka @ 2024-12-16 21:49:04
#include <bits/stdc++.h>
#define ll long long
#define db double
#define bl bool
#define itn int
using namespace std;
const int N = 100;
itn n,pd;
string s;
string b;
int p1,p2;
int main(){
cin>>n>>s;
for (int i = 0; i < n; ++i) {
cin>>pd;
if(pd==1)
{
cin>>b;
s=s+b;
cout<<s<<endl;
}
if(pd==2)
{
cin>>p1>>p2;
s=s.substr(p1,p2);
cout <<s<<endl;
}
if(pd==3)
{
cin>>p1>>b;
s.insert(p1,b);
cout<<s<<endl;
}
if(pd==4)
{
cin>>b;
bool p=false;
for (int j = 0; j <= s.size()-b.size(); ++j) {
if(s.substr(j,b.size())==b){
cout<<j;
p = true;
break;
}
}
if(!p)cout<<"-1"<<endl;
}
}
}
by m2217650826 @ 2024-12-18 10:53:22
我跟你一样,你解决了吗