diff options
| author | CY Fung <fungcheokyin@gmail.com> | 2022-08-30 00:59:57 +0800 |
|---|---|---|
| committer | CY Fung <fungcheokyin@gmail.com> | 2022-08-30 00:59:57 +0800 |
| commit | c5d821dde8d8a8be20f911fa8e6201d80074e1ad (patch) | |
| tree | e3fe89f4e12359b289cce88c8a0fc61247801fb0 | |
| parent | 1f8b55a1682d241a0bef0b38d2765c95affcfbd3 (diff) | |
| download | perlweeklychallenge-club-c5d821dde8d8a8be20f911fa8e6201d80074e1ad.tar.gz perlweeklychallenge-club-c5d821dde8d8a8be20f911fa8e6201d80074e1ad.tar.bz2 perlweeklychallenge-club-c5d821dde8d8a8be20f911fa8e6201d80074e1ad.zip | |
Week 180 Task 1
| -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 ); |
