Write a program that reads a list of words. Then, the program outputs those words and their frequencies.
Ex: If the input is:
hey hi Mark hi mark
the output is:
hey 1
hi 2
Mark 1
hi 2
mark 1
Here's what I tried:
list = 'hey hi Mark hi mark'
text = list.split()
for word in text:
freq = text.count(word)
print(*text, freq)