| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 151588 | Kevin | 31统计单词数 | C++ | Accepted | 1 MS | 288 KB | 291 | 2026-04-15 09:17:27 |
#include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin,s); int len=s.size(); int n=0,cnt=0; for(int i=0;i<len;i++){ if(s[i]==' '){ if(n>0){ cnt++; n=0; } } else{ n++; } } if(n>0) cnt++; cout<<cnt; return 0; }