A more complex version of “How can I tell if a string repeats itself in Python?”
I was reading this post and I wonder if someone can find the way to catch repetitive motifs into a more complex string. For example, find all the repetitive motifs in string = 'AAACACGTACGTAATTCCGTGTGTCCCCTATACGTATACGTTT' Here the repetitive motifs: 'AAAC ACGTACGT AATTCC GTGTGT CCCC TATACGTATACG TTT' So, the output should be something like this: output = {'ACGT': {'repeat': 2, 'region': (5,13)}, 'GT': {'repeat': 3, 'region': (19,24)}, 'TATACG': {'repeat': 2, 'region': (29,40)}} This example comes from a typical biological phenomena termed microsatellite which is present into the DNA. UPDATE 1: