Skip to content

Instantly share code, notes, and snippets.

Created November 30, 2014 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/17ecf9ecb4ad9df10e5b to your computer and use it in GitHub Desktop.
Save anonymous/17ecf9ecb4ad9df10e5b to your computer and use it in GitHub Desktop.
/*print a single blank for any number of blanks*/
#include <stdio.h>
#include <stdbool.h>
#include <ctype.h>
int main()
{
int c = getchar();
while (c != EOF) {
if (isblank(c)) {
while (c == ' ') {
c = getchar();
}
putchar(' ');
} else {
putchar(c);
c = getchar();
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment