commit - c4d09d889b490e037088cc0bfd290f273ea8dca4
commit + dd283985cab6c0e01be7cebcd2ce764578f02181
blob - 988f4bbeb82ce6dc19e2e3bd99edd391fba385d3
blob + a61766dee63bf7b93e0ed278120022dfcc6e0fce
--- 1-10.c
+++ 1-10.c
#include <stdio.h>
int main() {
int c;
- enum { out, in } word; /* indicates whether inside a word */
while ((c = getchar()) != EOF) {
- if (c == ' ' || c == '\t') {
- if (word == in) {
- putchar(' ');
- }
- word = out;
- } else {
- putchar(c);
- word = in;
+ switch (c) {
+ case '\t': printf("\\t"); break;
+ case '\b': printf("\\b"); break;
+ case '\\': printf("\\\\"); break;
+ default: putchar(c); break;
}
}
}
blob - 2eef88e39e244b31e7c3a11b9b7758db261b54a9
blob + 2867b9a0d3181fcbc1cca986a292382b2da2dcd4
Binary files a.out and a.out differ