What is the simple way to count the indexes(locations) of overlap characters identically between two string?
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
I realize I have some issues with my function. Could someone please point out and explain? That would be so helpful!
sample:
overlap('abcb','dbeb') #output >>> 2, not 4
overlap('','winter') #output >>> 0.