#include <iostream>
#include <string>
using namespace std;
int main() {
    std::string s;
    std::getline(cin, s);

    int i = s.length() - 1;
    // 从末尾开始,定位最后一个单词的末位索引
    while (i >= 0 && s[i] == ' ') {
        i--;
    }

    int end =