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