COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
checkpoint6.6.cpp File Reference
#include <iostream>
#include <string>
Include dependency graph for checkpoint6.6.cpp:

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void )

Definition at line 5 of file checkpoint6.6.cpp.

5 {
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}