31 lines
628 B
C
31 lines
628 B
C
#include <stdio.h>
|
|
|
|
#define MAX_LEN 100
|
|
|
|
int main() {
|
|
char c;
|
|
int ausgabe_laengen[MAX_LEN] = {0};
|
|
int laenge = 0;
|
|
|
|
c = getchar();
|
|
|
|
do {
|
|
if(c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z'){
|
|
laenge++;
|
|
} else if(laenge > 0){
|
|
ausgabe_laengen[laenge]++;
|
|
laenge = 0;
|
|
}
|
|
}while((c = getchar())!= EOF);
|
|
|
|
printf("Wortlaenge |\tAnzahl |\n");
|
|
printf("-----------+-----------|\n");
|
|
|
|
for (int i = 1; i < MAX_LEN; ++i) {
|
|
if(ausgabe_laengen[i] != 0){
|
|
printf("%10d |%10d |\n",i, ausgabe_laengen[i]);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
} |