Remove Duplicate Words
mediumQuestion 468Write a program that reads words from standard input until the input ends (use while (cin >> word); the words may be spread over several lines). Store the words in a set<string>, then print each distinct word on its own line in alphabetical order. All words are lowercase letters only.
Example input: banana apple banana
The output for that input is shown in Expected Output.
Expected output
apple banana bird cat dog
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
STL ContainersSets
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.