From 386ef3a667925d73ef65e4ae97f713798cb71ca4 Mon Sep 17 00:00:00 2001 From: ohmycloud Date: Sat, 4 Jul 2020 19:56:39 +0800 Subject: Solutions for challenges 067 --- challenge-067/ohmycloud/raku/ch-1.p6 | 3 +++ challenge-067/ohmycloud/raku/ch-2.p6 | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 challenge-067/ohmycloud/raku/ch-1.p6 create mode 100644 challenge-067/ohmycloud/raku/ch-2.p6 diff --git a/challenge-067/ohmycloud/raku/ch-1.p6 b/challenge-067/ohmycloud/raku/ch-1.p6 new file mode 100644 index 0000000000..10fbc21394 --- /dev/null +++ b/challenge-067/ohmycloud/raku/ch-1.p6 @@ -0,0 +1,3 @@ +sub MAIN(Int $m, Int $n) { + say (1..$m).combinations($n).grep: { [<] |$_ }; +} diff --git a/challenge-067/ohmycloud/raku/ch-2.p6 b/challenge-067/ohmycloud/raku/ch-2.p6 new file mode 100644 index 0000000000..a9dba6fbb8 --- /dev/null +++ b/challenge-067/ohmycloud/raku/ch-2.p6 @@ -0,0 +1,18 @@ +sub MAIN(Str $s) { + my %h = + 2 => 'abc', + 3 => 'def', + 4 => 'ghi', + 5 => 'jkl', + 6 => 'mno', + 7 => 'pqrs', + 8 => 'tuv', + 9 => 'wxyz'; + + my $r = $s.trans('01' => ''); + if $r.chars > 0 { + say unique [X~] %h{$r.comb}ยป.comb; + } else { + say []; + } +} -- cgit