fork download
  1. #include <stdio.h>
  2.  
  3. #define SPACE ' '
  4.  
  5. int main(void)
  6. {
  7. int space = 0;
  8.  
  9. int c;
  10. while ((c = getchar()) != EOF) {
  11. if (c == SPACE) {
  12. if (space == 0) {
  13. ++space;
  14. putchar(c);
  15. } else if (space > 0) {
  16. ++space;
  17. }
  18. } else {
  19. space = 0;
  20. putchar(c);
  21. }
  22. }
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
Standard output is empty