Run ID:73428

提交时间:2024-05-18 21:27:40

#include<bits/stdc++.h> using namespace std; int main(){ string a; getline(cin,a); int y=a.size(); int n=0; for(int i=0;i<=y;i++){ if(a[i]==' '&&a[i-1]!=' ') { cout<<n<<","; n=0; }else{ n++; } if(i==y){ cout<<n-1; } } return 0; }