genome = memoryview('abcdefghijkrhirejtvejtijvioecjtiovjitrejabababcd'.
    encode('ascii'))
genomeLength = len(genome)
minlen, maxlen = 2, 22

def fragments():
    for start in range(0, genomeLength - minlen):
        for finish in range(start + minlen, start + maxlen):
            if finish <= genomeLength:
                yield genome[start:finish]
count = Counter(fragments())
for mv, n in count.most_common(3):
    pass
Манипуляции со строками кажутся неэффективными