mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-03 17:26:21 +00:00
40 lines
688 B
C
40 lines
688 B
C
|
#include <stdio.h>
|
||
|
|
||
|
int main() {
|
||
|
char c;
|
||
|
int count = 0;
|
||
|
int printed = 0;
|
||
|
|
||
|
while (scanf("%c", &c) != EOF, c != '.') {
|
||
|
if (c == ' ') {
|
||
|
if (count != 0) {
|
||
|
if (printed == 0) {
|
||
|
printf("%d", count);
|
||
|
|
||
|
printed = 1;
|
||
|
} else {
|
||
|
printf(" %d", count);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
count = 0;
|
||
|
} else {
|
||
|
count++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (count != 0) {
|
||
|
if (printed == 0) {
|
||
|
printf("%d", count);
|
||
|
|
||
|
printed = 1;
|
||
|
} else {
|
||
|
printf(" %d", count);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
printf("\n");
|
||
|
|
||
|
return 0;
|
||
|
}
|