Write a C++ program that counts the number of words in a string.A word is encoun- tered whenever a transition from a blank space toa nonblank character is encountered. The string contains only wordsseparated by blank spaces.
Expert Answer
Answer to Write a C++ program that counts the number of words in a string. A word is encoun- tered whenever a transition from a bl…