You must enter the lines S and S0. Remove from S string all substrings that coincide with S0. If there are no matching substrings, then print line S without change.
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#define SIZE 200
main(){
char s[SIZE];
char s0[SIZE];
char *t;
printf("Enter a line:\n");
gets(s);
printf("Enter the search condition:\n");
gets(s0);
while(true){
t=strstr(s,s0);
printf("Matches not found:\n");
if(t!=NULL){
char *t1=t+strlen(s0);
strcpy(t,t1);
printf("Match is deleted:\n");
}else {
printf("The end result:\n");
}
break;
}
puts(s);
getch();
return 0;
}
I do not know how to implement the removal of a few match. I need help!!!