icebear_BAI @ 2024-12-28 11:08:09
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
string str;
cin>>n>>str;
for (int i=1;i<=n;i++)
{
string str1;
int a;
cin>>a;
int q,s,c;
if (a==1)
{
cin>>str1;
str+=str1;
cout<<str<<endl;
}
if (a==2)
{
string str2;
cin>>q>>s;
for (int j=q;j<=q+s;j++)
{
str2+=str[j];
}
str=str2;
cout<<str<<endl;
}
if (a==3)
{
string str3;
cin>>c>>str3;
string strl3="";
for (int j=0;j<str.length();j++)
{
strl3+=str[j];
if (j==c-1)
{
strl3+=str3;
}
}
str=strl3;
cout<<str<<endl;
}
if (a==4)
{
cin>>str1;
if (str.find(str1)<100)
{
cout<<str.find(str1)<<endl;
}
else
{
cout<<-1<<endl;
}
}
}
return 0;
}