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