Function for counting a letter in a string