Unique Word Tracker
hardQuestion 474Build a class UniqueWords that stores the distinct words in a set<string>. It must provide these public methods:
1. void add(const string& word): records the word. Every call counts toward the total, but a word that was added before does not increase the unique count.
2. int unique() const: returns how many distinct words have been added.
3. int totalAdded() const: returns how many times add has been called in total, including repeats.
4. bool seen(const string& word) const: returns true if the word has been added at least once, false otherwise.
5. void printSorted() const: prints each distinct word on its own line in alphabetical order. Prints nothing at all if no words were added.
The test prints the labels itself. After adding apple, pear, apple, kiwi, pear (in that order) (see Expected Output).
Do NOT write a main function.
Expected output
Unique: 3 Total: 5 apple kiwi pear Unique: 0 Total: 0 true false zebra
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...