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

class Solution {
public:
    int CountWordLen(string str) {
        int len = str.size();
        if(len == 0) return 0;
        int count = 0;
        for(int i = len-1; i>=0 && str[i] != ' '; i--) {
            count++;
        }
        return count;
    }
};

 int main() {
     Solution S;
     string str;
     while(getline(cin,str)) {
         cout << S.CountWordLen(str) << endl;
     }
     return 0;
 }