perl -e '@a=qw(g a t c g a t c g a t c); for(1..1000000){$x=int(1000*rand());$s.=$a[$x]} while($s=~/(?\w{3,})\w*\g{repeat}/g){ $m=$+{repeat};$c=()=$s=~/$m/;print "$m : $c\n"}' gcacgt : 1 cga : 1 tggg : 1 ttg : 1 tta : 1 cct : 1