| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 148352 | 陈奕涵 | 31统计单词数 | C++ | Accepted | 0 MS | 288 KB | 367 | 2026-02-11 11:43:18 |
#include<iostream> #include<cstring> using namespace std; int main(){ string s; getline(cin,s); int cnt=0,n=0; for(int i=0;i<s.size();i++){ if(s[i]==' '){ if(cnt>0){ n++; cnt=0; } } else cnt++; } if(cnt>0)n++; cout<<n<<endl; return 0; }