Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
159255 李沐阳 31统计单词数 C++ Accepted 3 MS 284 KB 265 2026-08-27 13:14:58

Tests(10/10):


Code:

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