#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[80],temp[80],word[20];
int i,j=0,c=0;
gets(str);
gets(word);
strcat(str," ");
for(i=0;str[i]!='\0';i++)
{
if(str[i]!=' ')
{
temp[j]=str[i];
j++;
}
else
{
temp[j]='\0';
if(strcmp(temp,word)==0)
c++;
}
}
printf("%d",c);
getch();
}
now my problem is that it is counting only the first word.. what's wrong with the code??