Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
97560 任斌 31单词的长度 C++ Wrong Answer 1 MS 280 KB 475 2024-11-16 11:08:50

Tests(0/5):


Code:

#include<bits/stdc++.h> using namespace std; int main() { string str; int cnt=0; int isfirst=true; getline(cin,str); for(int i=0;i<str.length();i++){ if(' '== str[i]){ if(cnt>0){ if(isfirst){ cout<<cnt; isfirst=false; }else{ cout<<","<<cnt; } cnt=0; } else{ cnt++; } } } if(cnt>0){ if(isfirst){ cout<<cnt; } else{ cout<<","<<endl; } } cout<<endl; return 0; }


Run Info:

------Input------
I will stare no effort to master a good command of advance XXX.
------Answer-----
1,4,5,2,6,2,6,1,4,7,2,7,4
------Your output-----
1,1,1,1,1,1