题解 | #字符串最后一个单词的长度#
字符串最后一个单词的长度
http://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
#include<bits/stdc++.h>
using namespace std;
int main(){
string str;
int count=0;
getline(cin,str);
for(int i=0;i<str.size();i++){
if(str[i]!=' ')
count++;
else
count=0;
continue;
}
cout<<count<<endl;
}