Advertisement
Guest User

Untitled

a guest
Dec 17th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define IN 1
  4. #define OUT 0
  5.  
  6. main()
  7. {
  8. int c, i, j, cwlen, state;
  9. int wlen[15];
  10.  
  11. state = OUT;
  12. for (i = 0; i < 15; ++i)
  13. wlen[i] = 0;
  14.  
  15. while ((c = getchar()) != EOF)
  16. if (c != ' ' && c != '\t' && c != '\n') {
  17. ++cwlen;
  18. state = IN;
  19. } else if (state = IN) {
  20. ++wlen[cwlen];
  21. cwlen = 0;
  22. state = OUT;
  23. }
  24.  
  25. for (i = 1; i < 15; ++i) {
  26. for (j = 1; j <= wlen[i]; ++j)
  27. putchar('|');
  28. putchar('\n');
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement