All pastes #239327 Raw Edit

Something

public text v1 · immutable
·published 2006-11-05 08:45 UTC
rendered paste body
#include<stdio.h>
#include<string.h>
#define MAX 300

int fn(char* str,char* s);

int main()
{
    char str[MAX],s[MAX];
    int ans[MAX],i=0,j=0; 
    char *p;
    
    while((scanf("%s %s",str,s)) != EOF)
        ans[i++] = fn(str,s);
        
    for(j=0;j<i;j++)
      printf("\n%d",ans[j]);
      
    return 0;
}

int fn(char* str,char* s)
{
    int len = strlen(str);
    int l = strlen(s);
    int i=0,j=0,cnt=0;
    
    for(;i<len;i++)
    {
       for(;j<l;j++)
       {
         if(s[j] == str[i+j])
           {
                 if(j == l-1)
                   {
                         cnt++;
                         i = i+l;
                         break;
                   }
           }
         else
           break;
       }
    }
    return cnt;
}