Hi I'm trying to count how many times each letter occurs, but am only able to count the number of unique letters.
Sample input would is: ABBCCC
Sample output is: A = 1, B = 2, C = 3
This is what I have so far:
Your code looks like the sort of code you get when you just start writing code without a real plan - it's far more convoluted and complicated than it needs to be. May I suggest you get a pen and paper and write out in plain text the steps you would take to solve the problem yourself and then look to convert that to code.
Just to add more detail to my suggestion, Here's 2 basic ways of solving this written in plain text.
1. Look at each letter in turn and if it's not in my results list add it to the list and then iterate across the rest of the string to count how many times that letter occurs and write down the total number of occurrences.
2. Look at each letter in turn and if it's not in my results list add it to the list with the number 1 next to it. If it is in the list add 1 to the number next to it.