Example 3: (a) Standardizing all of the strings with a single
call to the transform algorithm. (b) using the full generality of
transform to combine the two steps into one. (c) sorting and
removing duplicates.
(a) transform ( words.begin(), words.end(),
words.begin(), standardize );
(b) transform (istream_iterator< string, ptrdiff_t >( cin ),
istream_iterator< string, ptrdiff_t >(),
inserter( words, words.end() ),
standardize )
(c) sort( words.begin(), words.end() );
vector< string >::iterator i =
unique( words.begin(), words.end() );
copy( words.begin(), i,
ostream_iterator< string > ( cout, "\n") );