diff options
| author | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2025-11-21 12:34:12 +0000 |
|---|---|---|
| committer | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2025-11-21 12:34:12 +0000 |
| commit | a1b81fb77f325f898f398524aedfd1b8465e574a (patch) | |
| tree | 6d9c26f81c39843c7d993107620aa2ee7e72f3b3 | |
| parent | f78af743547a81363d461f6a84e430a50e07ac7d (diff) | |
| download | perlweeklychallenge-club-a1b81fb77f325f898f398524aedfd1b8465e574a.tar.gz perlweeklychallenge-club-a1b81fb77f325f898f398524aedfd1b8465e574a.tar.bz2 perlweeklychallenge-club-a1b81fb77f325f898f398524aedfd1b8465e574a.zip | |
- Added solutions to task #1 of week #348.
26 files changed, 123 insertions, 38 deletions
diff --git a/challenge-348/mohammad-anwar/perl/ch-1.pl b/challenge-348/mohammad-anwar/perl/ch-1.pl new file mode 100644 index 0000000000..cc479f2ce0 --- /dev/null +++ b/challenge-348/mohammad-anwar/perl/ch-1.pl @@ -0,0 +1,24 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Test::More; + +my @examples = ( + { in => "textbook", exp => 0 }, + { in => "book", exp => 1 }, + { in => "AbCdEfGh", exp => 1 }, + { in => "rhythmmyth", exp => 0 }, + { in => "UmpireeAudio", exp => 0 }, +); + +is(string_alike($_->{in}), $_->{exp}) for @examples; + +done_testing; + +sub string_alike { + my $s = shift; + my $l = length($s)/2; + my $v = substr($s,0,$l) =~ y/aeiouAEIOU//; + return $v > 0 && $v == substr($s,$l) =~ y/aeiouAEIOU// ? 1 : 0; +} diff --git a/challenge-348/mohammad-anwar/python/ch-1.py b/challenge-348/mohammad-anwar/python/ch-1.py new file mode 100644 index 0000000000..cd7e445582 --- /dev/null +++ b/challenge-348/mohammad-anwar/python/ch-1.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +def string_alike(s: str) -> int: + length = len(s) // 2 + vowels = "aeiouAEIOU" + v = sum(1 for char in s[:length] if char in vowels) + return 1 if v > 0 and v == sum(1 for char in s[length:] if char in vowels) else 0 + +if __name__ == "__main__": + examples = [ + {"in": "textbook", "exp": 0}, + {"in": "book", "exp": 1}, + {"in": "AbCdEfGh", "exp": 1}, + {"in": "rhythmmyth", "exp": 0}, + {"in": "UmpireeAudio", "exp": 0}, + ] + + for example in examples: + result = string_alike(example["in"]) + expected = example["exp"] + print(f"Input: {example['in']} -> Got: {result}, Expected: {expected} {'PASS' if result == expected else 'FAIL'}") diff --git a/challenge-348/mohammad-anwar/raku/ch-1.raku b/challenge-348/mohammad-anwar/raku/ch-1.raku new file mode 100644 index 0000000000..1fb69f899b --- /dev/null +++ b/challenge-348/mohammad-anwar/raku/ch-1.raku @@ -0,0 +1,21 @@ +#!/usr/bin/env raku + +use Test; + +my @examples = ( + { in => "textbook", exp => 0 }, + { in => "book", exp => 1 }, + { in => "AbCdEfGh", exp => 1 }, + { in => "rhythmmyth", exp => 0 }, + { in => "UmpireeAudio", exp => 0 }, +); + +is(string-alike($_<in>), $_<exp>) for @examples; + +done-testing; + +sub string-alike(Str $s) { + my $l = $s.chars div 2; + my $v = $s.substr(0, $l).comb.grep({ /<[aeiouAEIOU]>/ }).elems; + return ($v > 0 && $v == $s.substr($l).comb.grep({ /<[aeiouAEIOU]>/ }).elems) ?? 1 !! 0; +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index a427ca94c9..38401d18e4 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -148,6 +148,20 @@ "data" : [ [ "Perl", + 1 + ], + [ + "Raku", + 1 + ] + ], + "id" : "Mohammad Sajid Anwar", + "name" : "Mohammad Sajid Anwar" + }, + { + "data" : [ + [ + "Perl", 2 ] ], @@ -355,6 +369,11 @@ "y" : 2 }, { + "drilldown" : "Mohammad Sajid Anwar", + "name" : "Mohammad Sajid Anwar", + "y" : 2 + }, + { "drilldown" : "Niels van Dijke", "name" : "Niels van Dijke", "y" : 2 @@ -409,7 +428,7 @@ } ], "subtitle" : { - "text" : "[Champions: 22] Last updated at 2025-11-21 12:09:11 GMT" + "text" : "[Champions: 23] Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge - 348" diff --git a/stats/pwc-language-breakdown-2019.json b/stats/pwc-language-breakdown-2019.json index f0b3277a4c..2b54cf86a3 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-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2020.json b/stats/pwc-language-breakdown-2020.json index 9e8bf224c2..dfa4a33ac2 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-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2021.json b/stats/pwc-language-breakdown-2021.json index 0c10d2ecf8..af34fa74cf 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-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2022.json b/stats/pwc-language-breakdown-2022.json index cd99fac786..dd57cd08dc 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-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2023.json b/stats/pwc-language-breakdown-2023.json index 3342f9c115..f1da2f08fa 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-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2024.json b/stats/pwc-language-breakdown-2024.json index 2b02ec8687..9391a7da14 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-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2025.json b/stats/pwc-language-breakdown-2025.json index e1aba13708..5fcb543cb2 100644 --- a/stats/pwc-language-breakdown-2025.json +++ b/stats/pwc-language-breakdown-2025.json @@ -8,11 +8,11 @@ "data" : [ [ "Perl", - 40 + 41 ], [ "Raku", - 12 + 13 ], [ "Blog", @@ -853,7 +853,7 @@ { "drilldown" : "348", "name" : "348", - "y" : 71 + "y" : 73 }, { "drilldown" : "347", @@ -1085,7 +1085,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 253eb7c9e4..02b5ea7f7c 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -10,11 +10,11 @@ "data" : [ [ "Perl", - 17936 + 17937 ], [ "Raku", - 9917 + 9918 ], [ "Blog", @@ -37,7 +37,7 @@ } ], "subtitle" : { - "text" : "Last updated at 2025-11-21 12:09:11 GMT" + "text" : "Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2025]" diff --git a/stats/pwc-leaders.json b/stats/pwc-leaders.json index c75cac130b..2ee73b5440 100644 --- a/stats/pwc-leaders.json +++ b/stats/pwc-leaders.json @@ -484,11 +484,11 @@ "data" : [ [ "Perl", - 180 + 181 ], [ "Raku", - 113 + 114 ], [ "Blog", @@ -951,7 +951,7 @@ { "drilldown" : "Mohammad Sajid Anwar", "name" : "31: Mohammad Sajid Anwar", - "y" : 748 + "y" : 752 }, { "drilldown" : "Wanderdoc", @@ -1053,7 +1053,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the score breakdown. Last updated at 2025-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the score breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "Team Leaders (TOP 50)" diff --git a/stats/pwc-summary-1-30.json b/stats/pwc-summary-1-30.json index aa173156d8..5fdc49bfcb 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-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 0897200353..796b65b54c 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-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 c3b104d4f5..006d3c8641 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-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 298e5b9ef2..8e80b8c683 100644 --- a/stats/pwc-summary-181-210.json +++ b/stats/pwc-summary-181-210.json @@ -28,7 +28,7 @@ 0, 0, 1, - 180, + 181, 0, 0, 40, @@ -63,7 +63,7 @@ 2, 0, 0, - 113, + 114, 1, 10, 40, @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 8b2dc918f7..4c1701ed72 100644 --- a/stats/pwc-summary-211-240.json +++ b/stats/pwc-summary-211-240.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 982e59921e..c7acf3fdbf 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-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 4dffef3679..e1fb39f958 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-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 b6fbe4454d..b4a37346ef 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-11-21 12:09:11 GMT" + "text" : "[Champions: 28] Last updated at 2025-11-21 12:34:06 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 eb97ebf6c1..f1821ef780 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-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 b67b171076..9c58a8f3a3 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-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 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 1602db6e31..9b8324ef28 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-11-21 12:09:11 GMT" + "text" : "[Champions: 30] Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary.json b/stats/pwc-summary.json index 8813818f54..3a4d0b8ca3 100644 --- a/stats/pwc-summary.json +++ b/stats/pwc-summary.json @@ -208,7 +208,7 @@ 0, 0, 1, - 114, + 115, 0, 0, 20, @@ -541,7 +541,7 @@ 1, 0, 0, - 72, + 73, 1, 5, 20, @@ -1009,7 +1009,7 @@ } ], "subtitle" : { - "text" : "[Champions: 328] Last updated at 2025-11-21 12:09:11 GMT" + "text" : "[Champions: 328] Last updated at 2025-11-21 12:34:06 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 5724d5c4ad..e47539c1fb 100644 --- a/stats/pwc-yearly-language-summary.json +++ b/stats/pwc-yearly-language-summary.json @@ -8,11 +8,11 @@ "data" : [ [ "Perl", - 2159 + 2160 ], [ "Raku", - 1041 + 1042 ], [ "Blog", @@ -151,7 +151,7 @@ { "drilldown" : "2025", "name" : "2025", - "y" : 4044 + "y" : 4046 }, { "drilldown" : "2024", @@ -188,7 +188,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:09:11 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-11-21 12:34:06 GMT" }, "title" : { "text" : "The Weekly Challenge Language" |
