diff options
| author | Myoungjin JEON <jeongoon@gmail.com> | 2020-08-20 23:06:23 +1000 |
|---|---|---|
| committer | Myoungjin JEON <jeongoon@gmail.com> | 2020-08-20 23:06:23 +1000 |
| commit | e88f016f5a9c9302316234cb0df62fa8291cd4e3 (patch) | |
| tree | c0cc9e68ab96b8dfda2fafd320dbdec56be50ef6 | |
| parent | 41f889c8b174cb05b173c458036a50764b420d82 (diff) | |
| download | perlweeklychallenge-club-e88f016f5a9c9302316234cb0df62fa8291cd4e3.tar.gz perlweeklychallenge-club-e88f016f5a9c9302316234cb0df62fa8291cd4e3.tar.bz2 perlweeklychallenge-club-e88f016f5a9c9302316234cb0df62fa8291cd4e3.zip | |
[ch-074/jeongoon] Perl and Raku solution sligthly modified
| -rw-r--r-- | challenge-074/jeongoon/perl/ch-2.pl | 2 | ||||
| -rw-r--r-- | challenge-074/jeongoon/raku/ch-2.raku | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/challenge-074/jeongoon/perl/ch-2.pl b/challenge-074/jeongoon/perl/ch-2.pl index 251885f8d9..1758963be6 100644 --- a/challenge-074/jeongoon/perl/ch-2.pl +++ b/challenge-074/jeongoon/perl/ch-2.pl @@ -11,10 +11,10 @@ sub uniq_sorted { sub printLNR ($) { my $str = shift; - my @candi = uniq_sorted( split '', $str ); for my $last_idx ( 1 .. length $str ) { my $sub_chars = substr $str, 0, $last_idx; + my @candi = uniq_sorted( split '', $sub_chars ); my $nr_pos = -1; my $nr_chr = '#'; diff --git a/challenge-074/jeongoon/raku/ch-2.raku b/challenge-074/jeongoon/raku/ch-2.raku index fba9030909..ab03aa5e41 100644 --- a/challenge-074/jeongoon/raku/ch-2.raku +++ b/challenge-074/jeongoon/raku/ch-2.raku @@ -8,10 +8,10 @@ use v6.d; role fnr { method sayLNR ( Str:D $str = self.Str ) { my @chars = $str.comb; - my @candi = @chars.unique; for 1 .. @chars.elems -> $last-index { my $sub-chars = $str.substr( 0, $last-index ); + my @candi = @sub-chars.unique; my $nr-pos = -1; my $nr-char = '#'; for @candi -> $c { |
