We were tasked to create a program that counts the total numbers of unique words from a user input and we are not allowed to use sets and dictionaries. Words with duplicates or identical words should not be counted. I have a code and it works with other inputs but when I input "facebook face face book" or something similar it counts 3 instead of 2.
def unique_counter():
words = input().lower().split()
unique_words = {}
for word in words:
try:
unique_words[word] += 1
except KeyError:
unique_words[word] = 1
print(len(unique_words))
unique_counter()