//#include "stdafx.h"//If the vc++6.0, with this line.
#include "
stdio.h"
#include "
string.h"
int main(void){
char a[81],b[81],k,*p,lb;
printf("Please enter a string...\n");
fgets(a,80,stdin);
printf("To enter a search string...\n");
while(fgets(b,80,stdin))//保证b不为空,否则会引发错误
if(b[(lb=strlen(b)-1)]='\0',*b=='\0')
continue;
else break;
k=0,p=a;
while(p)
if(p=strstr(p,b))
k++,p+=lb;
printf("There is(are) %d \'%s\' in the strings\n",k,b);
return 0;
}