1 #include<stdio.h>
2 #include<stdlib.h>
3 #include<string.h>
4
5 int main()
6 {
7 char string[255];
8 int i,num=0,word=0;
9 char c;
10 gets(string);
11 for(i=0;(c=string[i])!='';i++)
12 {
13 if(c==' ')
14 word=0;
15 else if(word == 0)
16 {
17 word=1;
18 num++;
19 }
20 }
21 printf("There is %d word(s) in the line.",num);
22 return EXIT_SUCCESS;
23 }