Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <stdio.h>
- using namespace std;
- int main()
- {
- char s[256], c1[22], c2[22], *p, aux[22];
- gets(s);
- cin >> c1 >> c2;
- int n1 = strlen(c1);
- p = strstr(s, c1);
- while (p)
- {
- strcpy(aux, c2);
- strcat(aux, p + n1);
- strcpy(p, aux);
- p = strstr(s + 1, c1);
- }
- puts(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement