#!/usr/bin/env python

import fileinput, sys

from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL) 

for line in fileinput.FileInput(openhook=fileinput.hook_encoded("utf-8")):
    num_words = line.count(" ") + 1
    print(num_words)
