Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <sstream>
- #include <string>
- using namespace std;
- int main()
- {
- string a, b, c;
- int n=0, m=0, z=0, s1=0, s2=0;
- getline (cin, a);
- getline (cin, b);
- getline (cin, c);
- n=a.size();
- m=b.size();
- z=c.size();
- s1 = a.find(b);
- s2 = a.find(c);
- if (s1<s2)
- {
- a.erase(s1, m);
- a.insert(s1, c);
- a.erase(s2+z-m, z);
- a.insert(s2+z-m, b);
- }
- else
- {
- a.erase(s2, z);
- a.insert(s2, b);
- a.erase(s1+m-z, m);
- a.insert(s1+m-z, c);
- }
- cout << a;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement