#include <stdio.h> int main(){ char ch; //输入的字符 int count = 0; //统计每个单词的字符数量 int len = 1; //统计有多少个单词,没有让输出 int arr[10] = {0}; //存放每个单词的字符数 int i = 0; while(scanf("%c", &ch) != EOF){ if(ch == '.') break; if(ch != ' ') { count++; } else{ arr[i++] = count; len++; count = 0; } } arr[i++] = count; for(int j = 0; j < i; j++) printf("%d ", arr[j]); return 0; }