Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
93121 万隽宇 31单词的长度 C++ Accepted 1 MS 276 KB 539 2024-10-10 18:28:20

Tests(5/5):


Code:

#include<iostream> // cin\cout\endl #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() using namespace std; string a; int main(){ int b=0,c=0; getline(cin,a); int len=a.length(); for(int i=0;i<len;i++){ if(a[i]==' '){ if(c==0){ cout<<b; c++; } else{ cout<<','<<b; } b=0; } else{ b++; } } cout<<','<<b; return 0; }