看代码,懂得都懂,不懂就真不懂
#include <bits/stdc++.h>
using namespace std;
string str, head, send;
int N, M, K;
int main()
{
cin >> str;
cin >> N;
while (N--)
{
cin >> M >> K >> head >> send;
M--;K--;
string T = str.substr(M ,K - M + 1);
str.erase(M, K - M + 1);
if (str.find(head + send) != str.npos)
{
str = str.substr(0, str.find(head + send) + head.size()) + T + str.substr(str.find(head + send) + head.size());
}
else
str += T;
}
cout << str << endl;
return 0;
}
标签:head,--,send,substr,str,L1,剪切,find,粘贴
From: https://www.cnblogs.com/pure4knowledge/p/17912263.html