AcWing 3546. 复制、剪切、粘贴
原题链接
简单
作者:
哈士奇真可爱
,
2021-05-28 10:38:36
,
所有人可见
,
阅读 292
//一发ac,2333
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
string ss;
int n;
cin>>s;
cin>>n;
while (n -- )
{
string op;
cin>>op;
if(op=="CUT")
{
int a,b;
cin>>a>>b;
ss="";
for(int i=a;i<=b;i++)
ss+=s[i];
s.replace(a,b-a+1,"");
cout<<s<<endl;
}
else if(op=="COPY")
{
int a,b;
cin>>a>>b;
ss="";
for(int i=a;i<=b;i++)
ss+=s[i];
cout<<s<<endl;
}
else
{
int a;
cin>>a;
s.replace(a+1,0,ss);
cout<<s<<endl;
}
}
}
哈哈哈
强啊