Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
113007 秦浩然 31统计单词数 C++ Accepted 1 MS 292 KB 323 2025-03-15 10:46:26

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int m=0,c=0; string b; getline(cin,b); int l=b.length(); for(int i=0;i<l;i++){ if(b[i]!=' '){ m++; } else{ if(m>0){ c++; } m=0; } } if(m>0){ cout<<c+1; } else{ cout<<c; } return 0; }