count character of each type in a string