Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
159252 张蔚林 31统计单词数 C++ Accepted 1 MS 296 KB 297 2026-08-27 13:08:02

Tests(10/10):


Code:

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