I have a list of items that looks like this:
A B C A A B D E A
Now I want to count the number of occurrences of each item. The result should look like this:
A 4 B 2 C 1 D 1 E 1
How can I do that? It is important to note that this should be flexible. That means if I add item F to the list, that item should also be considered in the result.