how to count characters in a string