Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
67950 冯诚阳 31单词的长度 C++ Accepted 1 MS 280 KB 728 2024-03-17 17:43:23

Tests(5/5):


Code:

#include<iostream> #include<cstring> using namespace std; int main(){ string str; int cnt=0,isf=true; getline(cin,str); for(int i=0;i<str.size();i++){ if(str[i]==' '){ if(cnt>0){ if(isf){ cout<<cnt; isf=false; } else{ cout<<","<<cnt; } cnt=0; } } else{ cnt++; } } if(cnt>0){ if(isf){ cout<<cnt; } else{ cout<<","<<cnt; } } cout<<endl; return 0; }