/* strip extra whitespace from input and print the result on standard
 * output */

#include <stdlib.h>
#include <stdio.h>

#define UNUSED(x) ((void) (x))
#define IS_SPACE(c) ((c) == '\t' || \
                     (c) == '\r' || \
                     (c) == '\n' || \
                     (c) == ' ')

int main(int argc, char *argv[]) {
  int c, lc;
  UNUSED(argc);
  UNUSED(argv);

  while ((c = getchar()) != EOF) {
    if (!IS_SPACE(lc) || !IS_SPACE(c))
      putchar(c);
    lc = c;              
  }

  fflush(stdout);
  return EXIT_SUCCESS;
}

