include <stdio.h>
include <stdlib.h>
int main(){
int i=0;
int idx, num=0;
char seq;
seq = (char)malloc(5000*sizeof(char));
gets(seq);
while((seq[i]) != '\0'){
i++;
};
while(i--){
if(seq[i] == ' '){
break;
}
num++;
}
printf("%d",num);
free(seq);
return 0;
}