Counting number of characters in a string