So i have a list of strings like this:
mylist = ['foo', 'bar', 'foo', 'bar', 'abc']
and i want to have output like this:
foo exists twice
bar exists twice
abc exists once
I've tried converting the list to a dictionary with the string as the key and the value gets incremented for every occurrence in the list. But I'm not able to sort the dictionary in a way that i can print the most strings with the most occurrences along with the word. I've also tried using a 2 dimensional arrays which didn't work either. Does anyone know a good way of doing this?