CJCoding With Joseph
15free / daySign inCreate account

Remove Duplicate Words

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 — 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.