I'm not quite sure what your goal is, the original goal seems to just turn a string of numbers into an array of ints. The code you provided looks like you are counting frequency.

I'd suggest you...