Read a count and then that many words. Print how many distinct words there were, whether any word repeated, and finally whether one more word you read is among them.
For 5, a b a c b, a:
3
true
true
Remember add returns false when the value was already there — that alone detects a repeat.