#include <stdio.h>
#include <string.h>
int zicuan(char src[],char dest[])
{
int i = 0;
int j = 0;
int count = 0;
int flag = 0;
while(src[i] != '\0')
{
while((src[i] == dest[j]) && (j < strlen(dest)))//将字符串与字串进行比较
{
i++;
j++;
flag = 1;//记录进入内层循环的情况
}
if(j == strlen(dest))
{
count++;
}
if(flag == 1)
{
flag = 0;
i--;
}
i++;
j = 0;
}
return count;
}
int main()
{
char src[10];
char dest[10];
int count = 0;
printf("请输入一个字符串:\n");
scanf("%s",src);
printf("请输入一个字串:\n");
scanf("%s",dest);
count = zicuan(src,dest);
printf("%d",count);
return 0;
}