Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3415 | 邓小龙 | 31单词的长度 | C++ | Wrong Answer | 0 MS | 264 KB | 473 | 2024-06-07 16:24:31 |
# include<iostream> #include<cstring> using namespace std; int main(){ string s; getline(cin,s); int cnt=0, lenn=s.size(); bool f=0;//默认为0.代表是第一个单词 for(int i=0;i<lenn;i++){ if(s[i]==' '){ if(cnt!=0) if(f==0){cout<<cnt;f=1;} else cout<<","<<cnt; cnt=0; } else{ cnt++; } } if(cnt!=0) cout<<cnt; return 0; }
------Input------
Good morning.
------Answer-----
4,8
------Your output-----
48