The Weekly Challenge - 359

Monday, Feb 2, 2026| Tags: Perl, Raku

TABLE OF CONTENTS


  1. HEADLINES

  2. SPONSOR

  3. RECAP

  4. PERL REVIEW

  5. RAKU REVIEW

  6. CHART

  7. NEW MEMBERS

  8. GUESTS

  9. TASK #1: Digital Root

10. TASK #2: String Reduction


HEADLINES


Welcome to the Week #359 of The Weekly Challenge.

Another extremely busy week for me, sorry. Keep contributing and sharing knowlege as always. Your energy never lets me down.


Below is my contributions to the Task #1 of Week #358.

Perl: source code

sub max_str_val {
    my @str = @_;

    my $max = 0;
    for (@str) {
        my $val = /^\d+$/ ? $_ : length $_;
        $max = $val if $val > $max;
    }

    return $max;
}

Raku: source code

sub max-str-val(*@str) {
    my $max = 0;
    for @str -> $s {
        my $val = $s ~~ /^ \d+ $/ ?? +$s !! $s.chars;
        $max = $val if $val > $max;
    }
    return $max;
}

Python: source code

def max_str_val(str_list):
    max_val = 0
    for s in str_list:
        if re.fullmatch(r'\d+', s):
            val = int(s)
        else:
            val = len(s)
        if val > max_val:
            max_val = val
    return max_val

Thank you Team PWC, once again.

Happy Hacking!!


Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.

  Week      Perl       Raku       Blog   
   354       54       23       16   
   355       51       23       24   
   356       44       18       13   
   357       50       21       25   
   358       51       21       25   

Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.

  Week      Guests       Contributions       Languages   
   354       15       61       18   
   355       17       69       21   
   356       13       39       11   
   357       16       69       19   
   358       17       69       20   

TOP 10 Guest Languages


Do you see your favourite language in the Top #10? If not then why not contribute regularly and make it to the top.

 1. Python     (4077)
 2. Rust       (1096)
 3. Ruby       (866)
 4. Haskell    (859)
 5. Lua        (834)
 6. C++        (688)
 7. Go         (628)
 8. JavaScript (618)
 9. C          (606)
10. BQN        (501)

Blogs with Creative Title


1. Stringed Max by Arne Sommer.

2. Maximum Encryption by Jorg Sommrey.

3. using brute force! by Luca Ferrari.

4. nbyqyyefswbuffyhay by Matthias Muth.

5. It’s What You Value by Packy Anderson.

6. A number of strings by Peter Campbell Smith.

7. Encrypted Max by Roger Bell_West.

8. Maximum Encryption by Simon Green.

9. When Strings Become Numbers and Letters Start Shifting by Vinod Kumar K.


GitHub Repository Stats


1. Commits: 47,603 (+101)

2. Pull Requests: 13,467 (+39)

3. Contributors: 273

4. Fork: 350

5. Stars: 209



We are looking for sponsor for monthly prize pot of US $50. If anyone interested please get in touch with us at perlweeklychallenge@yahoo.com. Thanks for your support in advance.


RECAP


Quick recap of The Weekly Challenge - 358 by Mohammad Sajid Anwar.


PERL REVIEW


If you missed any past reviews then please check out the collection.


RAKU REVIEW


If you missed any past reviews then please check out the collection.


CHART


Please take a look at the charts showing interesting data.

I would like to THANK every member of the team for their valuable suggestions. Please do share your experience with us.


NEW MEMBERS


Please find out How to contribute?, if you have any doubts.

Please try the excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


GUESTS


Please check out the guest contributions for the Week #358.

Please find past solutions by respected guests. Please share your creative solutions in other languages.


Task 1: Digital Root

Submitted by: Mohammad Sajid Anwar

You are given a positive integer, $int.

Write a function that calculates the additive persistence of a positive integer and also return the digital root.

Digital root is the recursive sum of all digits in a number until a single digit is obtained.

Additive persistence is the number of times you need to sum the digits to reach a single digit.

Example 1

Input: $int = 38
Output: Persistence  = 2
        Digital Root = 2

38 => 3 + 8 => 11
11 => 1 + 1 => 2

Example 2

Input: $int = 7
Output: Persistence  = 0
        Digital Root = 7

Example 3

Input: $int = 999
Output: Persistence  = 2
        Digital Root = 9

999 => 9 + 9 + 9 => 27
27  => 2 + 7 => 9

Example 4

Input: $int = 1999999999
Output: Persistence  = 3
        Digital Root = 1

1999999999 => 1 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 => 82
82 => 8 + 2 => 10
10 => 1 + 0 => 1

Example 5

Input: $int = 101010
Output: Persistence  = 1
        Digital Root = 3

101010 => 1 + 0 + 1 + 0 + 1 + 0 => 3

Task 2: String Reduction

Submitted by: Mohammad Sajid Anwar

You are given a word containing only alphabets,

Write a function that repeatedly removes adjacent duplicate characters from a string until no adjacent duplicates remain and return the final word.

Example 1

Input: $word = "aabbccdd"
Output: ""

Iteration 1: remove "aa", "bb", "cc", "dd" => ""

Example 2

Input: $word = "abccba"
Output: ""

Iteration 1: remove "cc" => "abba"
Iteration 2: remove "bb" => "aa"
Iteration 3: remove "aa" => ""

Example 3

Input: $word = "abcdef"
Output: "abcdef"

No duplicate found.

Example 4

Input: $word = "aabbaeaccdd"
Output: "aea"

Iteration 1: remove "aa", "bb", "cc", "dd" => "aea"

Example 5

Input: $word = "mississippi"
Output: "m"

Iteration 1: Remove "ss", "ss", "pp" => "miiii"
Iteration 2: Remove "ii", "ii" => "m"


Last date to submit the solution 23:59 (UK Time) Sunday 7th February 2026.


SO WHAT DO YOU THINK ?

If you have any suggestions or ideas then please do share with us.

Contact with me