Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
152624 万嘉宇 单词的长度 C++ Accepted 1 MS 272 KB 571 2026-04-28 20:10:50

Tests(5/5):


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(){ char a[1000]; cin.getline(a,1000); int x=0; for(int i=0;i<=strlen(a);i++){ if(a[i]==' '&&a[i+1]!=' '){ cout<<x<<","; x=0; } else if(a[i]!=' '){ x++; } }cout<<x-1; return 0; }