aboutsummaryrefslogtreecommitdiff
path: root/challenge-082/markus-holzer/raku/ch-2.raku
blob: cc6549050ed0c9dd1051c4b00eee5bfdd1b212b0 (plain)
1
2
3
4
5
6
unit sub MAIN( Str $A, Str $B, Str $C where $C.chars == $A.chars + $B.chars );

sub interleavable( Str $a, Str $b, Str $c ) {
    so grep { $c eq [~] $a.substr( 0, $^i ), $b, $a.substr( $^i ) }, ^$a.chars }

say +( interleavable( $A, $B, $C ) || interleavable( $B, $A, $C ) )