CountChars counts the number of occurences of characters in a text.