#include #include using namespace std; const char NEW_LINE {'\n'}; int main() { int spaceCount{0}, wordCount{0}, letterCount{0}, lineCount{0}; bool newWord{true}; size_t pos{0}; string line; char letter; getline(cin, line); while (cin) { if (line == "") { cout << "\tThis is a blank line." << endl; } pos = 0; newWord = true; ++lineCount; ++spaceCount; while (pos < line.size()) { letter = line[pos]; pos++; if (isspace(letter)) { newWord = true; ++spaceCount; } else { if (newWord) { ++wordCount; newWord = false; } ++letterCount; } } getline(cin, line); } 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; }