题解 | #字符串最后一个单词的长度#

字符串最后一个单词的长度

http://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da

#include #include #include using namespace std; int main() { int i=0; string s; getline(cin,s); reverse(s.begin(),s.end()); while(s[i]!=' '&&i<s.size()) { i++; } cout<<i<<endl; }

全部评论

相关推荐

头像
05-27 20:32
已编辑
深度学习
工行数据中心 偏运维养老 到手可能18w
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务