#include enum bool {FALSE=0, TRUE}; int startWord(int inword, char c) { return TRUE; // this is a lie } int endWord(int inword, char c) { return FALSE; // so it this } int main () { int lines = 0; /* Init the counters */ int bytes = 0; int words = 0; int isword = FALSE; char c = getchar(); /* Prime the loop */ while (c != EOF) { bytes++; if (startWord(isword,c)) { /* Start of a word? */ words++; isword = TRUE; } else if (endWord(isword,c)) { isword = FALSE; /* End of a word? */ } if (c == '\n') lines++; c = getchar(); } printf(" %d %d %d\n",lines, words, bytes); }