I'm doing a problem on rosalind that wants you to return the positions that a substring occurs in a longer string. The only problem is there is an overlapping occurrence and the output should be: 1, 3, 9 (assuming 0 based counting) but I'm only getting 1 and 9? Here's my code.
import re
s='GATATATGCATATACTT'
t='ATAT'
substrings=re.compile('ATAT')
matches=substrings.finditer(s)
for match in matches:
print(match.start()+1) #doesn't find overlapping ones
Any help would be appreciated, thanks!