/* Word count fixed */
int wordcount(char *str)
{
int count = 0;
char *s;
s = str;
while(*s != '\0' &&*s==' ')
s++; //Skip leading spaces
while(s != NULL)
{
s = strchr(s, ' '); //Find the first word break
if (s != NULL)
{
while(*s != '\0' && s == ' ') //Allow for multiple spaces
s++;
}
count++;
}
return(count);
}
// End of File