learn_c/intro/ex1_9.c

19 lines
249 B
C
Raw Permalink Normal View History

2023-11-13 18:18:50 +00:00
#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;
}
}