aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2025-09-29 13:44:58 +0100
committerMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2025-09-29 13:44:58 +0100
commitc0fd3c3e8e7e931ef8c91f43c28bffcbf6da3d11 (patch)
tree366e13efd550730dafda2f3291cffc21bb197b63
parentc3e4a018d6e0af922853a0910b1a780a3e419c4f (diff)
downloadperlweeklychallenge-club-c0fd3c3e8e7e931ef8c91f43c28bffcbf6da3d11.tar.gz
perlweeklychallenge-club-c0fd3c3e8e7e931ef8c91f43c28bffcbf6da3d11.tar.bz2
perlweeklychallenge-club-c0fd3c3e8e7e931ef8c91f43c28bffcbf6da3d11.zip
- Added solutions by Peter Campbell Smith.
- Added solutions by Mohammad Sajid Anwar.
-rw-r--r--challenge-341/mohammad-anwar/perl/ch-1.pl25
-rw-r--r--challenge-341/mohammad-anwar/python/ch-1.py29
-rw-r--r--stats/pwc-current.json36
-rw-r--r--stats/pwc-language-breakdown-2019.json2
-rw-r--r--stats/pwc-language-breakdown-2020.json2
-rw-r--r--stats/pwc-language-breakdown-2021.json2
-rw-r--r--stats/pwc-language-breakdown-2022.json2
-rw-r--r--stats/pwc-language-breakdown-2023.json2
-rw-r--r--stats/pwc-language-breakdown-2024.json2
-rw-r--r--stats/pwc-language-breakdown-2025.json8
-rw-r--r--stats/pwc-language-breakdown-summary.json6
-rw-r--r--stats/pwc-leaders.json12
-rw-r--r--stats/pwc-summary-1-30.json2
-rw-r--r--stats/pwc-summary-121-150.json2
-rw-r--r--stats/pwc-summary-151-180.json2
-rw-r--r--stats/pwc-summary-181-210.json4
-rw-r--r--stats/pwc-summary-211-240.json6
-rw-r--r--stats/pwc-summary-241-270.json2
-rw-r--r--stats/pwc-summary-271-300.json2
-rw-r--r--stats/pwc-summary-301-330.json2
-rw-r--r--stats/pwc-summary-31-60.json2
-rw-r--r--stats/pwc-summary-61-90.json2
-rw-r--r--stats/pwc-summary-91-120.json2
-rw-r--r--stats/pwc-summary.json10
-rw-r--r--stats/pwc-yearly-language-summary.json8
25 files changed, 131 insertions, 43 deletions
diff --git a/challenge-341/mohammad-anwar/perl/ch-1.pl b/challenge-341/mohammad-anwar/perl/ch-1.pl
new file mode 100644
index 0000000000..64517020a8
--- /dev/null
+++ b/challenge-341/mohammad-anwar/perl/ch-1.pl
@@ -0,0 +1,25 @@
+#!/usr/bin/env perl
+
+use v5.38;
+use Test::More;
+
+sub typable_word_count($str, $keys) {
+ my @words = split /\s+/, $str;
+ return scalar @words unless @$keys;
+
+ my $broken_chars = quotemeta(join '', @$keys);
+ return scalar grep { !/[$broken_chars]/i } split /\s+/, $str;
+}
+
+my $examples = [
+ { str => 'Hello World', keys => ['d'], exp => 1 },
+ { str => 'apple banana cherry', keys => ['a', 'e'], exp => 0 },
+ { str => 'Coding is fun', keys => [], exp => 3 },
+ { str => 'The Weekly Challenge', keys => ['a','b'], exp => 2 },
+ { str => 'Perl and Python', keys => ['p'], exp => 1 },
+];
+
+is(typable_word_count($_->{str}, $_->{keys}), $_->{exp}) for @$examples;
+
+done_testing;
+
diff --git a/challenge-341/mohammad-anwar/python/ch-1.py b/challenge-341/mohammad-anwar/python/ch-1.py
new file mode 100644
index 0000000000..1dbd7869c8
--- /dev/null
+++ b/challenge-341/mohammad-anwar/python/ch-1.py
@@ -0,0 +1,29 @@
+def typable_word_count(text: str, broken_keys: list[str]) -> int:
+ words = text.split()
+ if not broken_keys:
+ return len(words)
+
+ broken_chars = set(key.lower() for key in broken_keys)
+ typable_count = sum(
+ 1 for word in words
+ if all(char.lower() not in broken_chars for char in word)
+ )
+
+ return typable_count
+
+examples = [
+ ('Hello World', ['d'], 1),
+ ('apple banana cherry', ['a', 'e'], 0),
+ ('Coding is fun', [], 3),
+ ('The Weekly Challenge', ['a', 'b'], 2),
+ ('Perl and Python', ['p'], 1),
+]
+
+for text, keys, expected in examples:
+ result = typable_word_count(text, keys)
+ assert result == expected, (
+ f"Assertion Failed: Input: '{text}', Keys: {keys} | "
+ f"Expected: {expected}, Got: {result}"
+ )
+
+print("\nAll tests passed successfully.")
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index 0eb6fd0162..a729906d29 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -78,6 +78,16 @@
"data" : [
[
"Perl",
+ 1
+ ]
+ ],
+ "id" : "Mohammad Sajid Anwar",
+ "name" : "Mohammad Sajid Anwar"
+ },
+ {
+ "data" : [
+ [
+ "Perl",
2
]
],
@@ -93,6 +103,20 @@
],
"id" : "Niels van Dijke",
"name" : "Niels van Dijke"
+ },
+ {
+ "data" : [
+ [
+ "Perl",
+ 2
+ ],
+ [
+ "Blog",
+ 1
+ ]
+ ],
+ "id" : "Peter Campbell Smith",
+ "name" : "Peter Campbell Smith"
}
]
},
@@ -148,6 +172,11 @@
"y" : 2
},
{
+ "drilldown" : "Mohammad Sajid Anwar",
+ "name" : "Mohammad Sajid Anwar",
+ "y" : 1
+ },
+ {
"drilldown" : "Nicolas Mendoza",
"name" : "Nicolas Mendoza",
"y" : 2
@@ -156,13 +185,18 @@
"drilldown" : "Niels van Dijke",
"name" : "Niels van Dijke",
"y" : 2
+ },
+ {
+ "drilldown" : "Peter Campbell Smith",
+ "name" : "Peter Campbell Smith",
+ "y" : 3
}
],
"name" : "The Weekly Challenge - 341"
}
],
"subtitle" : {
- "text" : "[Champions: 9] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 11] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge - 341"
diff --git a/stats/pwc-language-breakdown-2019.json b/stats/pwc-language-breakdown-2019.json
index 0567040198..09521d449d 100644
--- a/stats/pwc-language-breakdown-2019.json
+++ b/stats/pwc-language-breakdown-2019.json
@@ -970,7 +970,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Language"
diff --git a/stats/pwc-language-breakdown-2020.json b/stats/pwc-language-breakdown-2020.json
index ae0319083f..7394712962 100644
--- a/stats/pwc-language-breakdown-2020.json
+++ b/stats/pwc-language-breakdown-2020.json
@@ -1223,7 +1223,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Language"
diff --git a/stats/pwc-language-breakdown-2021.json b/stats/pwc-language-breakdown-2021.json
index ae64ca90e6..69daea8cb5 100644
--- a/stats/pwc-language-breakdown-2021.json
+++ b/stats/pwc-language-breakdown-2021.json
@@ -1223,7 +1223,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Language"
diff --git a/stats/pwc-language-breakdown-2022.json b/stats/pwc-language-breakdown-2022.json
index 07b4c42487..7c2fdc057a 100644
--- a/stats/pwc-language-breakdown-2022.json
+++ b/stats/pwc-language-breakdown-2022.json
@@ -1223,7 +1223,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Language"
diff --git a/stats/pwc-language-breakdown-2023.json b/stats/pwc-language-breakdown-2023.json
index 8bd1bbbb9d..4b58b767ad 100644
--- a/stats/pwc-language-breakdown-2023.json
+++ b/stats/pwc-language-breakdown-2023.json
@@ -1200,7 +1200,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Language"
diff --git a/stats/pwc-language-breakdown-2024.json b/stats/pwc-language-breakdown-2024.json
index 1d74e2c27c..eee888dd3e 100644
--- a/stats/pwc-language-breakdown-2024.json
+++ b/stats/pwc-language-breakdown-2024.json
@@ -1246,7 +1246,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Language"
diff --git a/stats/pwc-language-breakdown-2025.json b/stats/pwc-language-breakdown-2025.json
index d954f2d855..fc96a205f5 100644
--- a/stats/pwc-language-breakdown-2025.json
+++ b/stats/pwc-language-breakdown-2025.json
@@ -8,7 +8,7 @@
"data" : [
[
"Perl",
- 12
+ 15
],
[
"Raku",
@@ -16,7 +16,7 @@
],
[
"Blog",
- 0
+ 1
]
],
"id" : "341",
@@ -727,7 +727,7 @@
{
"drilldown" : "341",
"name" : "341",
- "y" : 18
+ "y" : 22
},
{
"drilldown" : "340",
@@ -924,7 +924,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Language"
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 9c10213b0a..e735bff643 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -10,7 +10,7 @@
"data" : [
[
"Perl",
- 17545
+ 17548
],
[
"Raku",
@@ -18,7 +18,7 @@
],
[
"Blog",
- 6284
+ 6285
]
],
"dataLabels" : {
@@ -37,7 +37,7 @@
}
],
"subtitle" : {
- "text" : "Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Contributions [2019 - 2025]"
diff --git a/stats/pwc-leaders.json b/stats/pwc-leaders.json
index 386124ee29..0492dfa983 100644
--- a/stats/pwc-leaders.json
+++ b/stats/pwc-leaders.json
@@ -276,11 +276,11 @@
"data" : [
[
"Perl",
- 406
+ 408
],
[
"Blog",
- 196
+ 197
]
],
"id" : "Peter Campbell Smith",
@@ -480,7 +480,7 @@
"data" : [
[
"Perl",
- 173
+ 174
],
[
"Raku",
@@ -877,7 +877,7 @@
{
"drilldown" : "Peter Campbell Smith",
"name" : "17: Peter Campbell Smith",
- "y" : 1204
+ "y" : 1210
},
{
"drilldown" : "Paulo Custodio",
@@ -947,7 +947,7 @@
{
"drilldown" : "Mohammad Sajid Anwar",
"name" : "31: Mohammad Sajid Anwar",
- "y" : 722
+ "y" : 724
},
{
"drilldown" : "Robert Ransbottom",
@@ -1049,7 +1049,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the score breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the score breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "Team Leaders (TOP 50)"
diff --git a/stats/pwc-summary-1-30.json b/stats/pwc-summary-1-30.json
index e118f2f1dd..ac98e6a4d7 100644
--- a/stats/pwc-summary-1-30.json
+++ b/stats/pwc-summary-1-30.json
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-121-150.json b/stats/pwc-summary-121-150.json
index 0c8641795a..ca4e1fc9e0 100644
--- a/stats/pwc-summary-121-150.json
+++ b/stats/pwc-summary-121-150.json
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-151-180.json b/stats/pwc-summary-151-180.json
index 4c5bd72c9f..994dad60ea 100644
--- a/stats/pwc-summary-151-180.json
+++ b/stats/pwc-summary-151-180.json
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-181-210.json b/stats/pwc-summary-181-210.json
index 3b28c95acb..d49f47efb7 100644
--- a/stats/pwc-summary-181-210.json
+++ b/stats/pwc-summary-181-210.json
@@ -28,7 +28,7 @@
0,
0,
1,
- 173,
+ 174,
0,
0,
40,
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-211-240.json b/stats/pwc-summary-211-240.json
index 2803a847f1..b05c96ba1c 100644
--- a/stats/pwc-summary-211-240.json
+++ b/stats/pwc-summary-211-240.json
@@ -26,7 +26,7 @@
4,
180,
0,
- 406,
+ 408,
1,
282,
10,
@@ -96,7 +96,7 @@
0,
0,
0,
- 196,
+ 197,
0,
0,
2,
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-241-270.json b/stats/pwc-summary-241-270.json
index a11c60b37e..1e0e8ba18e 100644
--- a/stats/pwc-summary-241-270.json
+++ b/stats/pwc-summary-241-270.json
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-271-300.json b/stats/pwc-summary-271-300.json
index ffd7f43dbf..4e47595919 100644
--- a/stats/pwc-summary-271-300.json
+++ b/stats/pwc-summary-271-300.json
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-301-330.json b/stats/pwc-summary-301-330.json
index 6c73b09def..0f046d4e21 100644
--- a/stats/pwc-summary-301-330.json
+++ b/stats/pwc-summary-301-330.json
@@ -109,7 +109,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 28] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 28] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-31-60.json b/stats/pwc-summary-31-60.json
index ea693d7bf5..7ecf27b083 100644
--- a/stats/pwc-summary-31-60.json
+++ b/stats/pwc-summary-31-60.json
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-61-90.json b/stats/pwc-summary-61-90.json
index fc8cca748d..73f346c435 100644
--- a/stats/pwc-summary-61-90.json
+++ b/stats/pwc-summary-61-90.json
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary-91-120.json b/stats/pwc-summary-91-120.json
index fd748c5ae6..155fe2c735 100644
--- a/stats/pwc-summary-91-120.json
+++ b/stats/pwc-summary-91-120.json
@@ -115,7 +115,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 30] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 30] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-summary.json b/stats/pwc-summary.json
index d8d0ec68c8..a2d0a40081 100644
--- a/stats/pwc-summary.json
+++ b/stats/pwc-summary.json
@@ -208,7 +208,7 @@
0,
0,
1,
- 107,
+ 108,
0,
0,
20,
@@ -236,7 +236,7 @@
2,
102,
0,
- 206,
+ 207,
1,
141,
5,
@@ -397,8 +397,8 @@
6,
0,
0,
- 9,
1,
+ 9,
0,
104,
0,
@@ -902,7 +902,7 @@
0,
0,
0,
- 194,
+ 195,
0,
0,
2,
@@ -1009,7 +1009,7 @@
}
],
"subtitle" : {
- "text" : "[Champions: 328] Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "[Champions: 328] Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge [2019 - 2025]"
diff --git a/stats/pwc-yearly-language-summary.json b/stats/pwc-yearly-language-summary.json
index 8a3a5658e5..fed94e95f4 100644
--- a/stats/pwc-yearly-language-summary.json
+++ b/stats/pwc-yearly-language-summary.json
@@ -8,7 +8,7 @@
"data" : [
[
"Perl",
- 1774
+ 1777
],
[
"Raku",
@@ -16,7 +16,7 @@
],
[
"Blog",
- 697
+ 698
]
],
"id" : "2025",
@@ -151,7 +151,7 @@
{
"drilldown" : "2025",
"name" : "2025",
- "y" : 3350
+ "y" : 3354
},
{
"drilldown" : "2024",
@@ -188,7 +188,7 @@
}
],
"subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 11:44:35 GMT"
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-09-29 12:44:20 GMT"
},
"title" : {
"text" : "The Weekly Challenge Language"