Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
99273 | hby | 31单词的长度 | C++ | Accepted | 1 MS | 256 KB | 310 | 2024-11-24 18:57:12 |
#include<bits/stdc++.h> using namespace std; char a[10000]; int main() { gets(a); int len=strlen(a); int n=0; for(int i=0; i<=len; i++) { if(a[i]==' '&&a[i-1]!=' ') { cout<<n<<","; n=0; } else { n++; } if(i==len ) { cout<<n-1; } } return 0; }