这是代码
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int l;
string s;
cin>>s;
cout<<endl;
for(int i=0;i<n;i++)
{
cin>>l;
cout<<"nli:"<<n<<"-"<<l<<"-"<<i<<endl;
if(l==1)
{
string t;
cin>>t;
s=s+t;
cout<<s<<endl;
continue;
}
if(l==2)
{
int a,b;
string t;
cin>>a>>b;
for(int j=a;j<=a+b;j++) //b---a+b
t+=s[j];
s=t;
cout<<s<<endl;
continue;
}
if(l==3)
{
int a;
cin>>a;
string tuo,wei,zhong,lianjie;
cin>>zhong;
for(int j=0;j<=a;j++) //a-->size+a
{
tuo+=s[j];
}
for(int j=a;j<=s.size();j++)
{
wei+=s[j];
}
lianjie=tuo+zhong+wei;
cout<<lianjie<<endl;
continue;
}
if(l==4)
{
string t;
cin>>t;
cout<<"1111"<<t<<endl;
for(int j=0;j<=s.size();j++)
{
string wzy;
for(int k=j;k<=j+t.size();k++)
{
wzy+=s[k];
}
if(wzy==t)
{
cout<<j<<endl;
break;
}
else
cout<<"-1";
}
}
}
return 0;
}