Determining the number of times a substring occurs in a string : <p>I have a string "ABChi hi" and I would like to write a program to determine the number of times the substring "hi" occurs in the main string. So far, my code looks like this:</p>

<pre><code>    the_word = "ABChi hi"
    new_word = the_word.split()
    count = 0
    for i in new_word:
        if i == "hi":
            count += 1
</code></pre>

<p>The problem is that when I split the string, I get </p>

<pre><code>  ["ABChi", "hi"]
</code></pre>

<p>which will only help me count one of the two hi's that occur, although the correct answer is 2. Does anyone have any ideas on how to obtain the correct answer?</p>
