CJCoding With Joseph
15free / daySign inCreate account

Write 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
Topics
STL ContainersSets
Auto-input
banana apple banana\n
This input is automatically fed to your program's stdin
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.