Rep-string
for <1001110011 1110111011 0010010010 1010101010 1111111111 0100101101 0100100 101 11 00 1> {
if /^ (.+) $0+: (.*$) <?{ $0.substr(0,$1.chars) eq $1 }> / {
my $rep = $0.chars;
say .substr(0,$rep), .substr($rep,$rep).trans('01' => 'ππ'), .substr($rep*2);
}
else {
say "$_ (no repeat)";
}
}Output:
10011πππππ
1110ππππ11
001πππ0010
1010ππππ10
11111πππππ
0100101101 (no repeat)
010πππ0
101 (no repeat)
1π
0π
1 (no repeat)Last updated