Simple way to count character occurrences in a string