Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
151690 任艺宸 31统计单词数 C++ Accepted 1 MS 280 KB 573 2026-04-18 11:02:58

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n=0,cnt=0; string s; getline(cin,s); int l=s.size(); for(int i=0;i<l;i++){ if(s[i]==' '){ if(n>0){ cnt++; n=0; } } else{ n++; } } if(n>0)cnt++; cout<<cnt; return 0; }