#include
#include
int count=0;
char* str_1[30];
char* str_2[30];
int main(){
printf("输入母字符串:");
scanf("%s",str_1);
printf("输入子字符串:");
scanf("%s",str_2);
int i=0,j=0;
while(*(str_1+i)!='\0'){
while(*(str_1+i)==*(str_2+j)){
i++;
j++;
}
count++;
if(*(str_1+i)!=*(str_2+j)){
i=i-j+1;
j=0;
}
}
printf("子字符串在母字符串中出现的次数为:%d\n",count);
return 0;
}