Last active
February 18, 2021 07:26
-
-
Save phc15/a09e6808ece5e61e65aeed69a43c3c5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MAXLENGTH 10 | |
#define IN 1 | |
#define OUT 0 | |
int main(){ | |
int c, nc, i, max, state; | |
int wl[maxlength]; | |
nc = i = max = 0; | |
state = OUT; | |
while((c = getchar()) != EOF && i < MAXLENGTH) { | |
if(c != '\t' && c != ' ' && c != '\n') { | |
state = IN; | |
++nc; | |
} | |
else { | |
state = OUT; | |
if(nc != 0) { | |
wl[i++] = nc; | |
if(nc >= max) max = nc; | |
nc = 0; | |
} | |
} | |
} | |
for(int j = max; j > 0; --j) { | |
for(int k = 0; k < i; k++) { | |
if(wl[k] < j) { | |
printf(" "); | |
} | |
else { | |
printf("*"); | |
} | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment