Any way to count overlapped strings within another string?
<p>What is the simple way to count the indexes(locations) of overlap characters identically between two string?</p>

<pre><code>def overlap(string1, string2):

    count = 0

    for i in range(0,len(string1)-len(string2)+1):
        if string2 in string1[i:i+len(string2)]:
            count = count +1
    return count
</code></pre>

<p>I realize I have some issues with my function. Could someone please point out and explain? That would be so helpful!</p>

<p>sample:</p>

<pre><code>overlap('abcb','dbeb') #output &gt;&gt;&gt; 2, not 4
overlap('','winter')   #output &gt;&gt;&gt; 0.
</code></pre>