Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
132566 郝王骏程 31统计单词数 C++ Accepted 1 MS 288 KB 515 2025-10-08 20:07:09

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(){ string s; getline(cin,s); int a=s.size(),c=0,s1=0; for(int i=0;i<=a-1;i++){ if(s[i]==' '&&c!=0){ c=0; s1+=1; } else c++; } if(c>0) s1+=1; cout<<s1; return 0; }