diff options
| -rw-r--r-- | challenge-180/cheok-yin-fung/perl/ch-1.pl | 12 | ||||
| -rw-r--r-- | challenge-180/cheok-yin-fung/raku/ch-1.raku | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/challenge-180/cheok-yin-fung/perl/ch-1.pl b/challenge-180/cheok-yin-fung/perl/ch-1.pl new file mode 100644 index 0000000000..a7fe2de437 --- /dev/null +++ b/challenge-180/cheok-yin-fung/perl/ch-1.pl @@ -0,0 +1,12 @@ +use v5.30.0; + +my $s = "Long Live Perl"; +my @a = split "", $s; +my %hash; +for (0..$#a) { + $hash{$a[$_]} = 0 if $hash{$a[$_]} == 1; + $hash{$a[$_]} = 1 if !defined($hash{$a[$_]}); +} +my $i = 0; +++$i until $hash{$a[$i]} == 1; +say $i; diff --git a/challenge-180/cheok-yin-fung/raku/ch-1.raku b/challenge-180/cheok-yin-fung/raku/ch-1.raku new file mode 100644 index 0000000000..c744ca86c2 --- /dev/null +++ b/challenge-180/cheok-yin-fung/raku/ch-1.raku @@ -0,0 +1,2 @@ +my $s = "Long Live Perl"; +say index($s, first { $s.indices($_).elems == 1 }, $s.comb ); |
