xiaoyezi666 @ 2024-11-16 22:03:18
#include<bits/stdc++.h>
using namespace std;
void fun1(string &s)
{
string s2;
cin>>s2;
for(int i=0;i<s2.size();i++)
{
s+=s2[i];
}
cout<<s;
}
void fun2(string &s)
{
int a,b;
cin>>a>>b;
string s2=s;
s="";
for(int i=a;i<a+b;i++)
{
s+=s2[i];
}
cout<<s;
}
void fun3(string &s)
{
int m;
string s2;
string s1="";
string s3="";
cin>>m>>s2;
for(int i=0;i<m;i++)
{
s1+=s[i];
}
for(int i=m;i<s.size();i++)
{
s3+=s[i];
}
s=s1+s2+s3;
cout<<s;
}
void fun4(const string &s)
{
string s2;
cin>>s2;
size_t pos = s.find(s2);
if(pos==string::npos)
{
cout<<-1;
}
else
{
cout<<pos;
}
}
int main()
{
int n;
cin>>n;
string s;
cin>>s;
int m;
for(int i=0;i<n;i++)
{
cin>>m;
if(m==1)
{
fun1(s);
}
else if(m==2)
{
fun2(s);
}
else if(m==3)
{
fun3(s);
}
else if(m==4)
{
fun4(s);
}
}
return 0;
}
by OpenFar @ 2024-11-17 20:16:28
@xiaoyezi666是不是忘记换行了
by xiaoyezi666 @ 2024-11-18 18:02:34
@OpenFar谢谢已经全对了