#include<iostream>
#include<string>
using namespace std;
int CalStrLen(string str)
{
int ptr = static_cast<int>(str.length() - 1);
int len = 0;
while (str[ptr] == ' ')
{
ptr--;
if (ptr < 0) break;
}
while (str[ptr] != ' ')
{
len++;
ptr--;
if (ptr < 0) break;
}
return len;
}
int main()
{
int a = 0;
string s;
getline(cin,s);
a = CalStrLen(s);
cout << a << endl;
system("pause");
return 0;
}