#include using namespace std; const char NEW_LINE {'\n'}; int main() { int spaceCount{0}, wordCount{0}, letterCount{0}, lineCount{0}; bool newWord{true}; bool newLine{true}; char letter; while (cin) { letter = cin.get(); if (isspace(letter)) { if (NEW_LINE == letter) { ++lineCount; if (newLine) { cout << "\tThis is a blank line." << endl; } newLine = true; } else { newWord = true; newLine = false; } ++spaceCount; } else if (isalpha(letter)) { if (newWord) { ++wordCount; newWord = false; newLine = false; } ++letterCount; } } cout << "There were " << letterCount << " letters." << endl; cout << "There were " << spaceCount << " spaces." << endl; cout << "There were " << wordCount << " words." << endl; cout << "There were " << lineCount << " lines." << endl; cout << endl; cout << "WC output: " << lineCount << " " << wordCount << " " << letterCount+spaceCount << endl; return 0; }