xiexiaoyuawa @ 2023-09-23 17:46:53
图省事用的vector,测试数据没问题
#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<string> words;
int main(){
string tmp;
while(cin>>tmp && cin.get() != '\n'){
words.push_back(tmp);
}
words.push_back(tmp);
for(int i = 0;i < words.size();i++){
if(i != words.size()-1)cout<<words[i].size()<<',';
else cout<<words[i].size();
}
}