Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129232 罗安博 31统计单词数 C++ Accepted 2 MS 292 KB 293 2025-08-23 09:45:36

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; string a; int main(){ int s=0; getline(cin,a); int len=a.size(); int m=0 ,t=0; for(int i=0;i<len;i++){ if(a[i]==32){ if(a[i-1]!=32){ s++; } } } if(a[len-1]!=32){ s++; } cout<<s; }