Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135865 王丞杰 31单词的长度 C++ Accepted 1 MS 276 KB 282 2025-11-08 16:35:48

Tests(5/5):


Code:

#include<bits/stdc++.h> using namespace std; int main() { string s1; getline(cin,s1); int k=0; int a=s1.size(); for(int i=0;i<a;i++){ if(s1[i] != ' '){ k++; } else{ if(k !=0) cout<<k<<","; k = 0; } if(i==a-1){ cout<<k; } } }