Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3394 吴奕希 31统计单词数 C++ Accepted 0 MS 272 KB 355 2024-06-02 13:15:53

Tests(10/10):


Code:

# include<iostream> using namespace std; int main(){ string a; getline(cin, a); int cnt=0, _long=a.size(), letters=0; for(int i = 0; i < _long; i++){ if(a[i]!=32)letters++; else if(letters>0){ cnt++; letters=0; } } if(letters>0)cnt++; cout<<cnt; return 0; }