Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
118964 毛靖平 31单词的长度 C++ Accepted 1 MS 276 KB 432 2025-05-11 14:44:59

Tests(5/5):


Code:

#include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int main(){ string s2; int t=0; getline(cin,s2); int len=s2.length(); for(int i=0;i<len;i++){ if(s2[i]!=' '){ t++; } else if(s2[i]==' '&& t !=0){ cout<<t<<","; t=0; } if(i==len-1&&t!=0){ cout<<t; } } }