Advertisement
STANAANDREY

replace apar

Aug 26th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. //https://pastebin.com/mhPBmQc2
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char s[101], a[101], b[101],aux[100];
  8. char *p;
  9. cin.getline(s, 101);
  10. cin.getline(a, 101);
  11. cin.getline(b, 101);
  12. while (p = strstr(s, a))
  13. {
  14. strcpy(aux, b);
  15. strcat(aux, p + strlen(a));
  16. strcpy(p,aux);
  17. }
  18. puts(s);
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement