// Code derived from Stroustrup's PPP2 book// § 3.6.1 An example: find repeated words// -beginning on p 73#include<iostream>#include<string>usingstd::cin;usingstd::cout;usingstd::string;intmain(){cout<<"Please enter words (ctrl+d to end input)\n";intnumber_of_words=0;stringprevious=" ";// not a wordstringcurrent;while(cin>>current){++number_of_words;// increase word countif(previous==current)cout<<"word number "<<number_of_words<<" repeated: "<<current<<'\n';previous=current;}}