

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#include <iostream>
using namespace std;
string s1,s2,s3;
int main() {
int t;
cin >> t;
cin.ignore();
while (t--) {
getline(cin,s1);
getline(cin,s2);
getline(cin,s3);
while (s1.find(s2)<s1.size()) {
int temp = s1.find(s2);
s1.erase(temp, s2.size());
s1.insert(temp,s3);
}
cout << s1 << endl;
}
}
Hãy giúp mọi người biết câu trả lời này thế nào?
#include <bits/stdc++.h>
using namespace std;
int main()
{
int q;
cin >> q;
cin.ignore();
for(int i=1;i<=q;i++)
{
string y, x1, x2;
getline(cin, y);
getline(cin, x1);
getline(cin, x2);
while(y.find(x1)<y.size())
{
int d=y.find(x1);
y.replace(d,x1.size(),x2);
}
cout<<y<<endl;
}
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin