fork download
  1. #include <stdio.h>
  2.  
  3. #define IN 1
  4. #define OUT 0
  5.  
  6. int main()
  7. {
  8. int c, nc, nl, nw, state;
  9.  
  10. state = OUT;
  11. nc = nl = nw = 0;
  12. while ((c = getchar()) != EOF) {
  13. ++nc;
  14. if (c == '\n')
  15. ++nl;
  16. if (c == ' ' || c == '\n' || c == '\t')
  17. state = OUT;
  18. else if (state == OUT) {
  19. state = IN;
  20. ++nw;
  21. }
  22. }
  23. printf("%d %d %d\n", nc, nl, nw);
  24. }
Success #stdin #stdout 0s 2164KB
stdin
Standard input is empty
stdout
0 0 0