#include"stdio.h"
#include "string.h"
#define N 80
int wordNum(char *str);
int main()
{
char s[N];
int wordnum = 0;
printf("Please enter a string:\n"); //gai
fgets(s);
wordnum = wordNum(s);
printf("The words of string is %d\n", wordnum);
}
int wordNum(char *str)
{
int n = 0;
while (*str != '\0')
{
if(*str == ' ')
n++;
str++;
}
return n;
}