Kiparisss

Untitled

Dec 18th, 2019
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<conio.h>
  4.  
  5.  
  6. void main()
  7. {
  8. char inputSentence[256];
  9. char inputWord[256];
  10. int lengthSentence;
  11. int lengthWord;
  12. char* cut;
  13.  
  14. gets_s(inputSentence);
  15. gets_s(inputWord);
  16. lengthWord = strlen(inputWord);
  17.  
  18. while (cut = strstr(inputSentence, inputWord))
  19. {
  20.  
  21. lengthSentence = strlen(inputSentence);
  22. for (int i = 0; i < lengthSentence - lengthWord; i++)
  23. {
  24. cut[i] = cut[i + lengthWord + 1];
  25. }
  26. cut[lengthSentence - lengthWord] = '\0';
  27. }
  28. puts(inputSentence);
  29. _getch();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment