#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>


int main() {
    char *s = 0; size_t n = 0; int c = 0;
    int l = getline(&s,&n,stdin);
    char *p=s + l - 1;      // move to end
    while(p-- > s){         // scan backward
        if(!isspace(*p)) c++;
        else if(c) break;
    }
    printf("%d\n",c);
    free(s);
}