how to find number of occurrence of a character in a string