#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int sum(0), w(0),f(0);
while(getline(cin,s)){
w=s.size();
for(int i=0; i<w; i++){
if(isalpha(s[i])!=0) f=1;
if(isalpha(s[i])==0 && f==1) {sum++; f=0;}
if(i==w-1 && f==1) {sum++; f=0;}
}
cout<<sum<<endl;
sum=0;
}
}