diff options
| -rw-r--r-- | challenge-216/luca-ferrari/raku/ch-1.p6 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-216/luca-ferrari/raku/ch-1.p6 b/challenge-216/luca-ferrari/raku/ch-1.p6 new file mode 100644 index 0000000000..bdef28ee4d --- /dev/null +++ b/challenge-216/luca-ferrari/raku/ch-1.p6 @@ -0,0 +1,25 @@ +#!raku + +# +# Perl Weekly Challenge 216 +# Task 1 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-216/> +# + +sub MAIN( *@strings is copy ) { + my @registration-code = @strings.pop.comb; + + # first implementation + for @strings -> $word { + my @result.push: @registration-code.grep( $_ ) for $word.comb; + say $word if @result.join ~~ $word; + } + + # second implementation + my $sorted-registration-code = @registration-code.sort.join; + for @strings -> $word { + say $word if ( $sorted-registration-code ~~ / ^ { $word.comb.sort.join } / ); + } + +} |
