题解 | #字符串最后一个单词的长度#
字符串最后一个单词的长度
https://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int N = 1e6;
int a, n;
char s[1000000];
string ss;
int main() {
while(cin>>ss){}
cout<<ss.length();
return 0;
}
最后一次输入的字符串有效,输出最后一次ss的length
