Loop through the string in the same manner as you do for the characters and add each numbers when any such character is found.