in reply to
Re: Golf (Inspired): Repeated Phrases
in thread Golf (Inspired): Repeated Phrases
I don't think this works quite right. Compare the output from the following two runs:
@l = repeated('this dog a round', 'this dog a pound', 1, 3);
@l = repeated('this dog a round', 'this dog a pound', 1, 4);
UPDATE: Here's an 85-byte version that returns all the matches:
sub repeated {
($s,$_,$m,$n)=@_;my@p;for$i($m..$n){$s=~$1&&push@p,$&while/\b(?=((\w+\
+b ?){$i}))/g}@p
}
MeowChow
s aamecha.s a..a\u$&owag.print