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