Let's say I have a function that takes in some string, and then I need to return the set of words in this string that occur exactly once. What is the best way to go about doing this? Would using dict be helpful? I've tried some pseudocode like:
counter = {}
def FindWords(string):
for word in string.split()
if (word is unique): counter.append(word)
return counter
Is there a better way to implement this? Thanks!
edit:
Say I have: "The boy jumped over the other boy". I want to return "jumped," "over," and "other."
Also, I'd like to return this as a set, and not a list.