String Splitter Write a function vector split(string str) that takes a string as...
String Splitter
Write a function vector split(string str) that takes a string as parameter and returns a vector of the distinct words in the string. A distinct word is any run of characters delimited by the beginning of the string, the end of the string, or whitespace. A consecutive run of whitespace characters is to be treated the same as a single whitespace character. Test your program by having the user enter lines of input, reading and splitting the line into words, and printing the words in the returned vector with each word on its own line. For example, the input.
Step-by-Step Solution
Request Professional Solution
Request Solution!
We need at least 10 more
requests to
produce the solution.