求大佬不吝赐教,c++代码如下:```cpp
#include
#include
using namespace std;
int main(){
int q=0;
string s="";
cin >> q ;
cin.ignore();// 清除输入缓冲区中的换行符
getline(cin,s);
int i=0;
while(i<q){
int t=0,a=0,b=0;
string str="";
cin >> t;
cin.ignore();// 清除输入缓冲区中的空格
if(t==1){
getline(cin,str);
s+=str;
cout << s << endl;
}
if(t==2){
cin >> a >> b;
str=s.substr(a,b);
s=str;
cout << s << endl;
}
if(t==3){
cin >> a;
cin.ignore();// 清除输入缓冲区中的空格 或者cin >> a >> str;
getline(cin,str);
s.insert(a,str);
cout << s << endl;
}
if(t==4){
int pos=0;
getline(cin ,str);
pos= s.find(str);
if(pos<s.size())
cout << pos << endl;
else
cout << -1 << endl;
}
i++;
}
return 0;
}