Changed a long time or not all over, and so on tomorrow to see it. Have a good rest and continue tomorrow.
#include <stdio.h> #include <string.h>
Char *delete (char Str1[80],char str2[80]) {
int LEN1,LEN2,L;//L record starting position with same character
Len1=strlen (STR1);
Len2=strlen (STR2);
for (int i=0;str1[i]!= '; i++ ') {
if (Str1[i]==str2[0]) {
l=i;//note where the same character appears
int num=0;
for (int k=0;k<len2;k++) {
if (Str1[l]==str2[k]) {
num++;
l++;
}
}//judgment is not exactly the same
Next, start with I, so that all the characters move forward three bits;
if (NUM==LEN2) {//If the substring is matched, then push the character back forward and squeeze the substring out of the string
for (int k=i;str1[k]!= ' n '; k++)
Str1[k]=str1[k+num];
}
}
}
return str1[80];
}
int main () {
Char str1[80];
Char str2[80];
Gets (STR1);
Gets (str2);//Get string
int fact=1;
while (fact) {
for (int j=0;str1[j]!= '; j + +) {
if (Str1[j]==str2[0]) {
Delete (STR1,STR2);//If the same as the first character of the substring, call the Remove function
fact=0;
}
}
if (fact==0)
Puts (STR1);
else{
for (int j=0;str1[j]!= '; j + +) {
if (Str1[j]==str2[0]) {
Delete (STR1,STR2);//If the same as the first character of the substring, call the Remove function
fact=0;
}
}
}
}
Puts (str1);//The substring after the output operation
return 0;
}