Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
99276 hby 31统计单词数 C++ Accepted 0 MS 268 KB 319 2024-11-24 19:01:58

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; char a[100000]; int main(){ int m=0,c=0; gets(a); int len=strlen(a); for(int i=0;i<len;i++){ if(a[i]!=' '){ m++; } else{ if(m>0){ c++; } m=0; } } if(m>0){ cout<<c+1; } else{ cout<<c; } return 0; }