Find longest repeating string based on input in perl (using subroutines)
问题 So I'm trying to find the longest repeat for a specific pattern thats given. My code so far looks like this, and is fairly close, however it does not fully give the wanted result: use warnings; use strict; my $DNA; $DNA = "ATATCCCACTGTAGATAGATAGAATATATATATATCCCAGCT" ; print "$DNA\n" ; print "The longest AT repeat is " . longestRepeat($DNA, "AT") . "\n" ; print "The longest TAGA repeat is " . longestRepeat($DNA, "TAGA") . "\n" ; print "The longest C repeat is " . longestRepeat($DNA, "C") . "\n