word = get_string(4 ** 12) + '$'

def matcher(word, match_string):
    positions = [-1]
while 1:
    positions.append(word.find(match_string, positions[-1] + 1))
if positions[-1] == -1:
    return positions[1:-1]
print(matcher(word, 'AAAAAAAAAAAA'))
[13331731, 13331732, 13331733]
print(matcher('AACTATAAATTTACCA', 'AT'))
[4, 8]
Работа с суффиксными деревьями в python