/*
Nome: Mario
Cognome: Montanari

contaParole
*/

#include <iostream>
#include <cctype>

#define SIZE 100+1

using namespace std;

void contaParole(const char *str);

int main(void) {
	char str[SIZE];
	
	cout << "Inserisci una frase: ";
	cin.getline(str, SIZE);
	
	contaParole(str);
	
	return 0;
}

void contaParole(const char *str) {
	int count = 0;
	char oldChr = ' ';
	
	for (int i = 0; str[i] != '\0'; i++) {
		if (isspace(oldChr) && !isspace(str[i])) {
			count++;
		}
		oldChr = str[i];
	}
	
	cout << count;
}