blob: db635515cb1f5ffb2c43e74081824677b412c94a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#! /usr/bin/env raku
unit sub MAIN (:s(:$string) = 'PERL',
:p(:$permutations) = "PELR PREL PERL PRLE PLER PLRE EPRL EPLR ERPL
ERLP ELPR ELRP RPEL RPLE REPL RELP RLPE RLEP
LPER LPRE LEPR LRPE LREP",
:v(:$verbose));
my %permuations = $permutations.words.Set;
my @missing;
for $string.comb.permutations>>.join -> $candidate
{
say ": Checking candidate: $candidate" if $verbose;
@missing.push: $candidate unless %permuations{$candidate};
}
say @missing.unique.join(", ") if @missing;
|