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: Max Words
10. TASK #2: Validate Coupon
HEADLINES
Welcome to the Week #353 of The Weekly Challenge.
Welcome aboard, Philip Sharman and thanks for your contributions for [Week #005], [Week #346], [Week #351] and [Week #352] in Perl.
Congratulations to all Raku contributors, we have now crossed 10K+ contributions. Perl is still leading the chart with 18K+ contributions.
Below is my contributions to the Task #1 of Week #352.
Perl: source code
sub match_string {
my @words = @_;
my %seen;
return [ grep {
my $word = $_;
!$seen{$word}++ && grep {
$_ ne $word && index($_, $word) >= 0
} @words
} @words ];
}
Raku: source code
sub match-string(*@words) {
my %seen;
return @words.grep(-> $word {
!%seen{$word}++ && @words.first(-> $other {
$other ne $word && $other.contains($word)
}).defined
}).Array;
}
Python: source code
def match_string(words):
seen = {}
result = []
for word in words:
if word in seen:
continue
seen[word] = True
for other in words:
if other != word and word in other:
result.append(word)
break
return result
Thank you Team PWC, once again.
Happy Hacking!!
Advent Calendar 2025
Contributions to the Advent Calendar so far by fellow members.
Day 1: 3-digits Even/Delete and Earn by Ali Moradi.
Day 2: Not Modified by Dave Jacoby.
Day 3: Alien Primes by Jorg Sommrey.
Day 4: Odd game by Peter Campbell Smith.
Day 5: Don’t Get Trapped by Matthias Muth.
Day 6: Exclusive or Common by Arne Sommer.
Day 7: Perl and Raku mainly by Luca Ferrari.
Day 8: Arrays Intersection/Sort Odd Even by Jaldhar H. Vyas.
Day 9: Lower the Sum by Roger Bell_West.
Day 10: Minimum Time/Balls and Boxes by W. Luis Mochan.
Day 11: Reverse Broken Keys for Letters by Adam Russell.
Day 12: Equal Strings/Sort Column by Robbie Hatley.
Day 13: Sub circular by Simon Green.
Day 14: Reverse Equals by Bob Lied.
Day 15: Count the Minimum Common Word by Packy Anderson.
Day 16: 2D Array/Total XOR by Yitzchak Scott-Thoennes.
Day 17: Day of the Year and Decompressed List by Walt Mankowski.
Day 18: Max Diff/Peak Point by Torgny Lyon.
Day 19: Brken Keybards and Reverse Prefixes by Ryan Thompson.
Day 20: Add to Array Form/Build Target from Source Subarrays by Vinod Kumar K.
Day 21: Format Date by Feng Chang.
Day 22: Lost Connections and Making Changes by David Ferrone.
Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.
Week |
Perl |
Raku |
Blog |
348 |
47 | 23 | 26 |
349 |
50 | 23 | 26 |
350 |
48 | 17 | 17 |
351 |
52 | 20 | 13 |
352 |
48 | 19 | 24 |
Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.
Week |
Guests |
Contributions |
Languages |
348 |
16 | 70 | 23 |
349 |
18 | 83 | 24 |
350 |
14 | 59 | 18 |
351 |
15 | 67 | 23 |
352 |
16 | 73 | 22 |
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 (3841)
2. Rust (1072)
3. Ruby (856)
4. Haskell (843)
5. Lua (812)
6. C++ (676)
7. JavaScript (608)
8. Go (604)
9. C (596)
10. BQN (493)
Blogs with Creative Title
1. Binary Match by Arne Sommer.
2. Five is the one-liest number by Bob Lied.
3. Triangular Squares by Jorg Sommrey.
4. and here comes Christmas by Luca Ferrari.
5. Doodling with matches and prefixes by Packy Anderson.
6. Bits of strings and strings of bits by Peter Campbell Smith.
7. Prefix the Matches in Strings of Binary by Roger Bell_West.
8. Strings and Binaries by Simon Green.
9. Not So Loopy Digits by Yitzchak Scott-Thoennes.
GitHub Repository Stats
1. Commits: 46,837 (+115)
2. Pull Requests: 13,180 (+40)
3. Contributors: 269 (+1)
4. Fork: 345 (+1)
5. Stars: 205 (+2)
SPONSOR
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 - 352 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
Philip Sharman, Perl hacker 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 #352.
Please find past solutions by respected guests. Please share your creative solutions in other languages.
Task 1: Max Words
Submitted by: Mohammad Sajid Anwar
You are given an array of sentences.
Write a script to return the maximum number of words that appear in a single sentence.
Example 1
Input: @sentences = ("Hello world", "This is a test", "Perl is great")
Output: 4
Example 2
Input: @sentences = ("Single")
Output: 1
Example 3
Input: @sentences = ("Short", "This sentence has seven words in total", "A B C", "Just four words here")
Output: 7
Example 4
Input: @sentences = ("One", "Two parts", "Three part phrase", "")
Output: 3
Example 5
Input: @sentences = ("The quick brown fox jumps over the lazy dog", "A", "She sells seashells by the seashore", "To be or not to be that is the question")
Output: 10
Task 2: Validate Coupon
Submitted by: Mohammad Sajid Anwar
You are given three arrays, @codes, @names and @status.
Write a script to validate codes in the given array.
A code is valid when the following conditions are true:
- codes[i] is non-empty and consists only of alphanumeric characters (a-z, A-Z, 0-9) and underscores (_).
- names[i] is one of the following four categories: "electronics", "grocery", "pharmacy", "restaurant".
- status[i] is true.
Return an array of booleans indicating validity: output[i] is true if and only if codes[i], names[i] and status[i] are all valid.
Example 1
Input: @codes = ("A123", "B_456", "C789", "D@1", "E123")
@names = ("electronics", "restaurant", "electronics", "pharmacy", "grocery")
@status = ("true", "false", "true", "true", "true")
Output: (true, false, true, false, true)
Example 2
Input: @codes = ("Z_9", "AB_12", "G01", "X99", "test")
@names = ("pharmacy", "electronics", "grocery", "electronics", "unknown")
@status = ("true", "true", "false", "true", "true")
Output: (true, true, false, true, false)
Example 3
Input: @codes = ("_123", "123", "", "Coupon_A", "Alpha")
@names = ("restaurant", "electronics", "electronics", "pharmacy", "grocery")
@status = ("true", "true", "false", "true", "true")
Output: (true, true, false, true, true)
Example 4
Input: @codes = ("ITEM_1", "ITEM_2", "ITEM_3", "ITEM_4")
@names = ("electronics", "electronics", "grocery", "grocery")
@status = ("true", "true", "true", "true")
Output: (true, true, true, true)
Example 5
Input: @codes = ("CAFE_X", "ELEC_100", "FOOD_1", "DRUG_A", "ELEC_99")
@names = ("restaurant", "electronics", "grocery", "pharmacy", "electronics")
@status = ("true", "true", "true", "true", "false")
Output: (true, true, true, true, false)
Last date to submit the solution 23:59 (UK Time) Sunday 28th December 2025.