aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-11-24 05:23:19 +0000
committerGitHub <noreply@github.com>2025-11-24 05:23:19 +0000
commit02c995c25e093cbd477deb4794bb6dacebd26a23 (patch)
treedc278c5a409ecd44e8ce64ef86dfef389b3042af
parent47b25bc8c6bd2281b62645fd8f8b59a3854f0f47 (diff)
parentcc5db5e69e730aff5ce5c7e0c2eac4aab95a4db9 (diff)
downloadperlweeklychallenge-club-02c995c25e093cbd477deb4794bb6dacebd26a23.tar.gz
perlweeklychallenge-club-02c995c25e093cbd477deb4794bb6dacebd26a23.tar.bz2
perlweeklychallenge-club-02c995c25e093cbd477deb4794bb6dacebd26a23.zip
Merge pull request #13075 from BarrOff/barroff-348
feat: add solution for challenge 348 from BarrOff
-rw-r--r--challenge-348/barroff/raku/ch-1.p627
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-348/barroff/raku/ch-1.p6 b/challenge-348/barroff/raku/ch-1.p6
new file mode 100644
index 0000000000..e1b1253705
--- /dev/null
+++ b/challenge-348/barroff/raku/ch-1.p6
@@ -0,0 +1,27 @@
+#!/usr/bin/env raku
+
+use v6.d;
+
+sub string-alike(Str $str --> Bool) {
+ my @str-split = $str.lc.comb;
+ my @p1 = grep({ @str-split[$_] ~~ /<[aeiou]>/ }, 0..^@str-split.elems div 2);
+ my @p2 = grep({ @str-split[$_] ~~ /<[aeiou]>/ }, @str-split.elems div 2 ..^ @str-split.elems);
+ return @p1.elems ≠ 0 && @p1.elems == @p2.elems;
+}
+
+#| Run test cases
+multi sub MAIN('test') {
+ use Test;
+ plan 5;
+
+ is string-alike("textbook"), False, 'works for "textbook"';
+ is string-alike("book"), True, 'works for "book"';
+ is string-alike("AbCdEfGh"), True, 'works for "AbCdEfGh"';
+ is string-alike("rhythmmyth"), False, 'works for "rhythmmyth"';
+ is string-alike("UmpireeAudio"), False, 'works for "UmpireeAudio"';
+}
+
+#| Take user provided string like "PerlWeeklyChallenge"
+multi sub MAIN(Str $str) {
+ say string-alike($str);
+}