#include #include int main() { string line; charclass alpha{ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" }; size_t i; try { for ( ;; ) { sin | getline( line ); for ( ;; ) { // scan words off line size_t posn = exclude( line, alpha ); // find position of 1st alphabetic character if ( posn == len( line ) ) break; // any characters left ? line = line( posn ); // remove leading whitespace posn = include( line, alpha ); // find position of 1st non-alphabetic character sout | line( 0, posn ); // extract word from start of line line = line( posn ); // delete word from line } // for } // for } catch( end_of_file * ) {} }