COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
checkpoint6.6.cpp
Go to the documentation of this file.
1#include <iostream>
2#include <string>
3using namespace std;
4
5int main(){
6 string first, second, third;
7 getline(cin, first);
8 cin >> second >> third;
9 int starting_from = 0;
10 while (first.find(second, starting_from) != string::npos){
11 starting_from = first.find(second, starting_from) + third.length();
12 first = first.replace(first.find(second, starting_from - third.length()), second.length(), third);
13 }
14 cout << first;
15}
int main()