#include <stdio.h>
#include <conio.h>
void main()
{
char a[100],b[10],t[20];
int i=0,n=0,w=1;
clrscr();
printf("\n Enter The String : ");
scanf("%[^\n]",a);
printf("\n Enter The Word Which Count : ");
scanf("%s",b);
while(a[i]!='\0')
{
t[n]=a[i];
if(a[i]==' ')
{
t[n]='\0';
//printf("\n %s",t);
n=-1;
if(strcmp(t,b)==0)
w++;
}
i++;
n++;
}
printf("\n %s comes %d times ",b,w-1);
getch();
}
/*
******
OUTPUT
******
Enter The String : MICHEL IS GOOD IN C C IS GOOD LANGUAGE
Enter The Word Which Count : GOOD
GOOD comes 2 times
*/