diff --git a/07-extra-blanks.c b/07-extra-blanks.c new file mode 100644 index 0000000..e875e6d --- /dev/null +++ b/07-extra-blanks.c @@ -0,0 +1,16 @@ +#include + +int main() +{ + int c; + int l; + + while ((c = getchar()) != EOF) { + if (c == ' ' && c == l) { + ; + } else { + printf("%c", c); + l = c; + } + } +} diff --git a/Makefile b/Makefile index 7e067df..babb6b7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: hello mathvars c2f input count countlines +all: hello mathvars c2f input count countlines blanks hello: 01-hello-world.c gcc -o ./bin/01-helloworld 01-hello-world.c @@ -18,5 +18,8 @@ count: 05-char-counting.c countlines: 06-line-count.c gcc -o ./bin/06-line-count 06-line-count.c +blanks: 07-extra-blanks.c + gcc -o ./bin/07-extra-blanks 07-extra-blanks.c + clean: $(RM) ./bin/*-*