The Weekly Challenge - 356

Monday, Jan 12, 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: Kolakoski Sequence

10. TASK #2: Who Wins


HEADLINES


Welcome to the Week #356 of The Weekly Challenge.

For us, officially, this is the first week of 2026 and what a great way to begin the journey - by welcoming two new members, Piotr Kolasinski and Patrick Steele.

Thank you, Piotr, for your first contributions in Python.

Thank you, Patrick, for your first contributions in Uiua.

Welcome to blogging, Marc Perry and thanks for sharing your first blog post. For some strange reason, I am getting this message:

This blog is open to invited readers only

David Ferrone, you pleasantly surprised me at the start of 2026 - thank you for your generous donation.

A few weeks ago, I shared about seeking a sponsor for 2026. Since Lance Wicks has been our solo sponsor for two years, I reached out to him again this year and am still waiting for his reply. In the meantime, I am looking for a new sponsor, just in case. We are hoping for a monthly prize pot of US $50. I must make this clear: the mission will carry on with or without a prize pot.

Returning to contributions, I am thrilled to begin the year with a bang. We nearly reached our milestone with 98 contributions from 32 contributors. Also received 69 guest contributions from 17 guest contributors.

As of today, we have 332 regular contributors and 34 guest contributors. Every week, I aim for 100+ regular contributions and 50+ guest contributions. And when we reach that target, I am the happiest person.

I just noticed that we have received 6,600 blog post to date, which is especially impressive considering the time period when not many people were writing about Perl or Raku. Well done Team PWC.

Last but not least, thank you, Simon Green, for the cool challenge this week Who Wins.


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

Perl: source code

sub thousand_separator {
    my ($num) = @_;
    $num =  reverse $num;
    $num =~ s/(\d{3})(?=\d)/$1,/g;
    return reverse $num
}

Raku: source code

sub thousand-separator(Int $num --> Str) {
    my $reversed = $num.flip;
    $reversed ~~ s:g/(\d**3) <?before \d>/$0,/;
    return $reversed.flip;
}

Python: source code

def thousand_separator(num):
    num_str = str(num)[::-1]
    num_str = re.sub(r'(\d{3})(?=\d)', r'\1,', num_str)
    return num_str[::-1]

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   
   351       52       22       15   
   352       52       21       26   
   353       54       20       24   
   354       54       23       16   
   355       51       23       24   

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

  Week      Guests       Contributions       Languages   
   351       15       67       23   
   352       16       73       22   
   353       16       73       19   
   354       15       61       18   
   355       17       69       21   

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     (3988)
 2. Rust       (1084)
 3. Ruby       (862)
 4. Haskell    (849)
 5. Lua        (824)
 6. C++        (682)
 7. Go         (618)
 8. JavaScript (614)
 9. C          (598)
10. BQN        (497)

Blogs with Creative Title


1. Mountain Separator by Arne Sommer.

2. Separated Mountains by Jorg Sommrey.

3. number formatting and sorting by Luca Ferrari.

4. Thousand Mountains by Matthias Muth.

5. Oh to live on Array Mountain… by Packy Anderson.

6. Thousands of mountains by Peter Campbell Smith.

7. Mountains by the Thousand by Roger Bell_West.

8. Commify every mountain by Simon Green.


GitHub Repository Stats


1. Commits: 47,271 (+127)

2. Pull Requests: 13,342 (+48)

3. Contributors: 272 (+1)

4. Fork: 349 (+3)

5. Stars: 207



With start of Week #268, we have a new sponsor Lance Wicks until the end of year 2025. Having said we are looking for more sponsors so that we can go back to weekly winner. 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 - 355 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


Piotr Kolasinski, Python hacker from Poland joined Team PWC.

Patrick Steele, Uiua hacker from USA joined Team PWC.


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 #355.

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


Task 1: Kolakoski Sequence

Submitted by: Mohammad Sajid Anwar

You are given an integer, $int > 3.

Write a script to generate the Kolakoski Sequence of given length $int and return the count of 1 in the generated sequence. Please follow the wikipedia page for more informations.

Example 1

Input: $int = 4
Output: 2

(1)(22)(11)(2) => 1221

Example 2

Input: $int = 5
Output: 3

(1)(22)(11)(2)(1) => 12211

Example 3

Input: $int = 6
Output: 3

(1)(22)(11)(2)(1)(22) => 122112

Example 4

Input: $int = 7
Output: 4

(1)(22)(11)(2)(1)(22)(1) => 1221121

Example 5

Input: $int = 8
Output: 4

(1)(22)(11)(2)(1)(22)(1)(22) => 12211212

Task 2: Who Wins

Submitted by: Simon Green

It’s NFL playoff time. Since the 2020 season, seven teams from each of the league’s two conferences (AFC and NFC) qualify for the playoffs based on regular season winning percentage, with a tie-breaking procedure if required. The top team in each conference receives a first-round bye, automatically advancing to the second round.

The following games are played. Some times the games are played in a different order. To make things easier, assume the order is always as below.

Week 1: Wild card playoffs

- Team 1 gets a bye
  - Game 1: Team 2 hosts Team 7
  - Game 2: Team 3 hosts Team 6
  - Game 3: Team 4 hosts Team 5
- Week 2: Divisional playoffs
  - Game 4: Team 1 hosts the third seeded winner from the previous week.
  - Game 5: The highest seeded winner from the previous week hosts the second seeded winner.
- Week 3: Conference final
  - Game 6: The highest seeded winner from the previous week hosts the other winner

You are given a six character string containing only H (home) and A away which has the winner of each game. Which two teams competed in the the conference final and who won?

Example 1

NFC Conference 2024/5. Teams were Detroit, Philadelphia, Tampa Bay, Los Angeles Rams, Minnesota, Washington and Green Bay. Philadelphia - seeded second - won.

Input: $results = "HAHAHH"
Output: "Team 2 defeated Team 6"

In Week 1, Team 2 (home) won against Team 7, Team 6 (away) defeated Team 3 and Team 4 (home) were victorious over Team 5. This means the second week match ups are Team 1 at home to Team 6, and Team 2 hosted Team 4.

In week 2, Team 6 (away) won against Team 1, while Team 2 (home) beat Team 4. The final week was Team 2 hosting Team 6

In the final week, Team 2 (home) won against Team 6.

Example 2

AFC Conference 2024/5. Teams were Kansas City, Buffalo, Baltimore, Houston, Los Angeles Charges, Pittsburgh and Denver. Kansas City - seeded first - won.

Input: $results = "HHHHHH"
Output: "Team 1 defeated Team 2"

Example 3

AFC Conference 2021/2. Teams were Tennessee, Kansas City, Buffalo, Cincinnati, Las Vegas, New England and Pittsburgh. Cincinnati - seeded fourth - won.

Input: $results = "HHHAHA"
Output: "Team 4 defeated Team 2"

Example 4

NFC Conference 2021/2. Teams were Green Bay, Tampa Bay, Dallas, Los Angeles Rams, Arizona, San Francisco and Philadelphia. The Rams - seeded fourth - won.

Input: $results = "HAHAAH"
Output: "Team 4 defeated Team 6"

Example 5

NFC Conference 2020/1. Teams were Green Bay, New Orleans, Seattle, Washington, Tampa Bay, Los Angeles Rams and Chicago. Tampa Bay - seeded fifth - won.

Input: $results = "HAAHAA"
Output: "Team 5 defeated Team 1"


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


SO WHAT DO YOU THINK ?

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

Contact with me