#include <iostream>
using namespace std;

int main() {
    string str;
    getline(cin, str);
    cout << str.size() - str.find_last_of(' ') - 1 << endl;
}