#include <iostream>                                // Ex25
#include <string>
using namespace std;
int main() {
    string line, word;
    string::size_type p, words = 0;
    for ( ;; ) {                                // scan lines from a file
        getline( cin, line );                    // read entire line, but not newline
      if ( cin.eof() ) break;                    // end-of-file ?
        line += '\n';                            // add newline character as sentinel character
