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

int main() {
   string str;
   //先读入字符串
   getline(cin, str);
   //然后使用rfind函数得到逆序查找倒数第一个空格
   size_t pos = str.rfind(' ');
   //使用size - (pos+1) 的值就是长度
   cout << str.size() - (pos + 1) << endl;

   return 0;

}
// 64 位输出请用 printf("%lld")