Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
82424 何思佳 31统计单词数 C++ Accepted 1 MS 268 KB 315 2024-07-13 11:16:57

Tests(10/10):


Code:

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