diff options
| -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 { |
