// Code derived from Stroustrup's PPP2 book// § 11.7 Using nonstandard separators// -and beginning on p 399#include<iostream>#include<sstream>#include<string>#include<vector>usingnamespacestd;intmain(){// example input: As planned, the guests arrived; then,cout<<"\n> ";stringline;getline(cin,line);// read into linefor(char&ch:line)// replace each punctuation character by a spaceswitch(ch){case';':case'.':case',':case'?':case'!':ch=' ';}stringstreamss{line};// make an istream ss reading from linevector<string>vs;for(stringword;ss>>word;)// read words without punctuation charactersvs.push_back(word);for(autoconst&s:vs)cout<<s<<'\n';}