fork download
  1. main()
  2. {
  3. int c, nl, sp, tb, done;
  4. nl, sp, tb, done = 0;
  5.  
  6. while (done == 0){
  7. c = getchar();
  8.  
  9. if (c == '\n')
  10. ++nl;
  11. if (c == ' ')
  12. ++sp;
  13. if (c == '\t')
  14. ++tb;
  15. if (c == EOF){
  16. if (c != '\n')
  17. ++nl;
  18. done = 1;
  19. }
  20. }
  21. printf("\nThe text has %d lines, %d spaces, and %d tabs.", nl, sp, tb);
  22. return 0;
  23. }
  24.  
  25.  
Success #stdin #stdout 0s 2252KB
stdin
all of the lights
stdout
The text has 1 lines, 3 spaces, and 0 tabs.