zhu0012 @ 2025-01-11 11:23:12
#include<bits/stdc++.h>
using namespace std;
string s,a;
int main()
{
int n;
cin>>n>>s;
getchar();
while(n--)
{
getline(cin,a);
if(a[0]=='1')
{
s=s+a.substr(2);
cout<<s<<endl;
}
else if(a[0]=='2')
{
s=s.substr(a[2]-'0',a[4]-'0');
cout<<s<<endl;
}
else if(a[0]=='3')
{
s.insert(a[2]-'0',a.substr(4));
cout<<s<<endl;
}
else if(a[0]=='4')
{
if(s.find(a.substr(2))<s.size())
cout<<s.find(a.substr(2))<<endl;
else
cout<<-1<<endl;
}
}
return 0;
}