Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
109869 | 邹昊辰 | 31统计单词数 | C++ | Accepted | 1 MS | 284 KB | 228 | 2025-02-13 10:39:28 |
#include<bits/stdc++.h> using namespace std; int main(){ string a; int f=0; getline(cin,a); int len=a.length(); for(int i=0;i<len;i++){ if(a[i]==' '&&a[i-1]!=' '){ f+=1; } } cout<<f+1; return 0; }