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: String Alike
10. TASK #2: Convert Time
HEADLINES
Welcome to the Week #348 of The Weekly Challenge.
Every week, we get blog post with creative and funny title. This week my favourite is Phone Dating by Jorg Sommrey.
Welcome back, Luca Ferrari, with complete set of solutions in Raku, Java, Python and PostgreSQL.
Thank you, Feng Chang, for sharing blog first time in Jupyter Notebook format.
As expected, we have some movement in the ranking for guest contributions, JavaScript, moved up one position to the rank #7.
Below is my contributions to the Task #1 of Week #347.
Perl: source code
sub format_date {
my $str = shift;
$str =~ /(\d+)\w{2} (\w{3}) (\d+)/;
sprintf("%04d-%02d-%02d", $3, 1+index("JanFebMarAprMayJunJulAugSepOctNovDec",$2)/3, $1);
}
Raku: source code
sub format-date(Str $str) {
$str ~~ /(\d+) \w**2 \s (\w**3) \s (\d+)/;
sprintf("%04d-%02d-%02d", $2, 1+index("JanFebMarAprMayJunJulAugSepOctNovDec", $1)/3, $0);
}
Python: source code
def format_date(date_str):
match = re.search(r'(\d+)\w{2} (\w{3}) (\d+)', date_str)
if match:
day, month, year = match.groups()
month_num = 1 + "JanFebMarAprMayJunJulAugSepOctNovDec".index(month) // 3
return f"{year}-{month_num:02d}-{int(day):02d}"
return ""
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 |
343 |
44 | 19 | 13 |
344 |
47 | 25 | 17 |
345 |
49 | 22 | 15 |
346 |
50 | 18 | 15 |
347 |
45 | 21 | 24 |
Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.
Week |
Guests |
Contributions |
Languages |
343 |
15 | 61 | 20 |
344 |
16 | 60 | 18 |
345 |
17 | 57 | 18 |
346 |
15 | 51 | 17 |
347 |
15 | 65 | 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 (3738)
2. Rust (1042)
3. Ruby (846)
4. Haskell (831)
5. Lua (792)
6. C++ (666)
7. JavaScript (598)
8. C (596)
9. Go (580)
10. BQN (483)
Blogs with Creative Title
1. Format, Format by Arne Sommer.
2. Phone Dating by Jorg Sommrey.
3. string mangling by Luca Ferrari.
4. Leave a Date and a Number, and I’ll Get Back to You by Matthias Muth.
5. Oh, oh, formatted strings, give me some thing… by Packy Anderson.
6. Frequent funny formats by Peter Campbell Smith.
7. Phone Number For a Date by Roger Bell_West.
8. The one about formatting by Simon Green.
GitHub Repository Stats
1. Commits: 46,296 (+115)
2. Pull Requests: 12,997 (+39)
3. Contributors: 265
4. Fork: 339
5. Stars: 199
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 - 347 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 #347.
Please find past solutions by respected guests. Please share your creative solutions in other languages.
Task 1: String Alike
Submitted by: Mohammad Sajid Anwar
You are given a string of even length.
Write a script to find if the given string split into two halves of equal lengths and they both have same number of vowels.
Example 1
Input: $str = "textbook"
Output: false
1st half: "text" (1 vowel)
2nd half: "book" (2 vowels)
Example 2
Input: $str = "book"
Output: true
1st half: "bo" (1 vowel)
2nd half: "ok" (1 vowel)
Example 3
Input: $str = "AbCdEfGh"
Output: true
1st half: "AbCd" (1 vowel)
2nd half: "EfGh" (1 vowel)
Example 4
Input: $str = "rhythmmyth"
Output: false
1st half: "rhyth" (0 vowel)
2nd half: "mmyth" (0 vowel)
Example 5
Input: $str = "UmpireeAudio"
Output: false
1st half: "Umpire" (3 vowels)
2nd half: "eAudio" (5 vowels)
Task 2: Covert Time
Submitted by: Mohammad Sajid Anwar
You are given two strings, $source and $target, containing time in 24-hour time form.
Write a script to convert the source into target by performing one of the following operations:
1. Add 1 minute
2. Add 5 minutes
3. Add 15 minutes
4. Add 60 minutes
Find the total operations needed to get to the target.
Example 1
Input: $source = "02:30"
$target = "02:45"
Output: 1
Just one operation i.e. "Add 15 minutes".
Example 2
Input: $source = "11:55"
$target = "12:15"
Output: 2
Two operations i.e. "Add 15 minutes" followed by "Add 5 minutes".
Example 3
Input: $source = "09:00"
$target = "13:00"
Output: 4
Four operations of "Add 60 minutes".
Example 4
Input: $source = "23:45"
$target = "00:30"
Output: 3
Three operations of "Add 15 minutes".
Example 5
Input: $source = "14:20"
$target = "15:25"
Output: 2
Two operations, one "Add 60 minutes" and one "Add 5 minutes"
Last date to submit the solution 23:59 (UK Time) Sunday 23rd November 2025.