Count the occurrences of a substring within a string.