Advertisement
edutedu

stergerea unui subsir dintr-un sir

Mar 26th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char a[100], b[100], *p ;
  8. cin>>a;
  9. cin>>b;
  10. p=strstr(a,b);
  11. int l=strlen(b);
  12. if(p==0)
  13. cout<<"Nu exista subsirul respectiv.";
  14. else
  15. do
  16. {
  17. strcpy(p, p+l);
  18. p=strstr(p, b);
  19. }while(p);
  20. cout<<a;
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement