learn_c/intro/ex1_9.c

19 lines
249 B
C

#include <stdio.h>
/* count lines in input */
main()
{
int c, nb;
nb = 0;
while((c = getchar()) != EOF)
if (c != ' ') {
putchar(c);
nb = 0;
}
else if ((c == ' ') && (nb == 0)) {
putchar(c);
++nb;
}
}