//Ex4_19.cpp
#include "iostream" 
using namespace std;
void main() 
{char str[80],c; 
 int i,num=0,word=0; //确保输入的m为正整数，r在2~16之间 
 gets(str);
 cout<<"原字符串:"<<str<<endl;
 for(i=0;(c=str[i])!='\0';i++)
    if(c==' ') word=0;
	else if(word==0) {word=1;num++;}
 cout<<"单词数为:"<<num<<endl; 
}
