#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
int main(int argc, char *argv[])
{
char in0[99999] ;
int ans=0;
while (cin.getline(in0,99999)){
for (short i=0 ;i<strlen(in0);i++ ){
if ((in0[i]>='a'&&in0[i]<='z')||(in0[i]>='A'&&in0[i]<='Z'))//判斷字的開始
{
for (;i<strlen(in0);i++){
if ((in0[i]>='a'&&in0[i]<='z')||(in0[i]>='A'&&in0[i]<='Z'))//判斷字的結束
{ans=ans;}
else
{ans++;break;}
}
}
}
if ((in0[strlen(in0)-1]>='a'&&in0[strlen(in0)-1]<='z')||(in0[strlen(in0)-1]>='A'&&in0[strlen(in0)-1]<='Z')){ans++;}
cout <<ans <<endl ;
ans=0;
}
}