#include <stdio.h>
#include <string.h>
void dele(char S1[],char S2[]);
int main()
{
char s1[100],s2[100];
gets(s1);
gets(s2);
dele(s1,s2);
puts(s1);
return 0;
}
void dele(char S1[],char S2[])
{
int i,j,k;
int len1=strlen(S1);
int len2=strlen(S2);
for(i=0,k=0;i<=len1-len2;)
{
for(j=0;S2[j]!='\0';j++)
{
if(S1[i+j]!=S2[j]) // //查看S1中的字符串片段是否是S2
break;
}
if(S2[j]!='\0')
{
S1[k++]=S1[i++]; //S1的查找往后移动一位或者删除S2的字符串
}
else
i+=len2;
}
while(S1[i]!='\0')
S1[k++]=S1[i++]; //将最后的字符输入
S1[k]='\0';
}
04-03
2237