#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main() {
    char s[100];
    fgets(s,sizeof(s),stdin);
    
    size_t len = strlen(s);
    if (len > 0 && s[len - 1] == '\n') {
        s[len - 1] = '\0';
    }
    
    for (int i = 0; s[i] != '\0'; i++) {
        if (!isalpha(s[i]) && !isspace(s[i])) {
            printf("invalid input\n");
            return 0;
        }
    }
    
    int lastLen = 0;
    int i = strlen(s) - 1;
    
    while (i >=0 && s[i] =='')
      i-;
    
    
    while (i >=0 && s[i] !='') {
        lastLen++;
        i-;
    }
    
    printf("%d\n", lastLen);
    return 0;
}