#include <iostream>
using namespace std;
int main() {
string s;
int n;
while(cin>>s) n=s.size();
cout<<n;
return 0;
}
// 64 位输出请用 printf("%lld")
一直输入每次都更新字符串长度,最后一次即为最后一个单词的长度
最后输出n即可

#include <iostream>
using namespace std;
int main() {
string s;
int n;
while(cin>>s) n=s.size();
cout<<n;
return 0;
}
// 64 位输出请用 printf("%lld")
一直输入每次都更新字符串长度,最后一次即为最后一个单词的长度
最后输出n即可