#include <iostream> using namespace std; int main(){ string str; while (getline(cin,str)){ int i,count,j=0; //count是单词长度 for (i = 0; str[i] !='.';i+=(count+1)){ count = 0;//重置 for (j = i;str[j] !=' ' && str[j] !='.';j++){ count++; } cout <<count <<" "; if (str[j] == '.') break; } } }