#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
while(getline(cin,s)){
int y=0,r=0;
for(int i=0;i<s.size();i++){
if(s[i]>='A'&&s[i]<='Z'||s[i]>='a'&&s[i]<='z') r=1;
else{y+=r; r=0;}
}
cout<<y<<"\n";
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
while(getline(cin,s)){
int y=0,r=0;
for(int i=0;i<s.size();i++){
if(s[i]>='A'&&s[i]<='Z'||s[i]>='a'&&s[i]<='z') r=1;
else{y+=r; r=0;}
}
cout<<y<<"\n";
}
return 0;
}
cout<<y 以前要再做一次y+=r 因為句尾不一定有標點符號