#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(){
    char s[21];
    fgets(s , sizeof(s) , stdin);
    s[strcspn(s, "\n")] = 0; // remove newline character
    // check for invalid input
    for (int i = 0; s[i]; i++){
        if (!isalpha(s[i]) && s[i] != ' '){
            printf("Invalid input\n");
            return 0;
        }
    }
int length  = strlen(s);
int last_word_length = 0;
// calculate lenght of last word
for (int i = length - 1; i >= 0; i--){
    if (s[i] == ' '){
        break;
    }
    1ast_word_lenght;
    }
printf("%d\n" , last_word_lenght);
return 0;
}