#include <iostream>
#include <string>
using namespace std;

/*
思路:从字符串结束开始向左查找到空格,计算出最后一个字符串长度
*/
int LastStrLen(string strIn)
{
    if(strIn.length() == 0) {
        return 0;
    }
    int lastStrCount = 0;
    int strLen = strIn.length();
    for(int i = strLen - 1; i >= 0; i--) {
        if(strIn[i] == ' ') {
            return lastStrCount;
        }
        lastStrCount++;
    }
    return lastStrCount;
}

int main()
{
    string strIn;
    while(getline(cin, strIn)) {
        cout<<LastStrLen(strIn)<<endl;
    }
    return 0;
}