Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<conio.h>
- void main()
- {
- char inputSentence[256];
- char inputWord[256];
- int lengthSentence;
- int lengthWord;
- char* cut;
- gets_s(inputSentence);
- gets_s(inputWord);
- lengthWord = strlen(inputWord);
- while (cut = strstr(inputSentence, inputWord))
- {
- lengthSentence = strlen(inputSentence);
- for (int i = 0; i < lengthSentence - lengthWord; i++)
- {
- cut[i] = cut[i + lengthWord + 1];
- }
- cut[lengthSentence - lengthWord] = '\0';
- }
- puts(inputSentence);
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment