#include<stdio.h>
#include<string.h>
int main()
{
char hua[1001];
char shi[1001];
int hua_len;
int shi_len;
int i;
int j;
bool matched;
int count;
while(scanf("%s",hua)!=EOF)
{
if(hua[0]=='#')
{
break;
}
scanf("%s",shi);
matched=true;
count =0;
hua_len=strlen(hua);
shi_len=strlen(shi);
for(i=0;i<hua_len;i++)
{
matched=true;
if(hua_len-i-shi_len<0)
{
break;
}
for(j=0;j<shi_len;j++)
{
if(hua[i+j]!=shi[j])
{
matched=false;
break;
}
}
if(matched)
{
count++;
i+=shi_len-1;
}
}
printf("%d\n",count);
}
return 0;
}
HDU - 2087
最新推荐文章于 2022-10-02 11:05:35 发布