Well, to give you some tips... (although I don't see any relation between the dashes and the output)
You could simply use standard string functions to split the string on each dash and leave out the empty strings. Then you can simply loop through the array and count all the same characters and output these.
Look into the standard string functions to check out what they can do to help you out.
Good luck!