diff options
| author | Andrey Shitov <ash@Andreys-iMac.local> | 2025-11-22 00:28:17 +0200 |
|---|---|---|
| committer | Andrey Shitov <ash@Andreys-iMac.local> | 2025-11-22 00:28:17 +0200 |
| commit | 5c93fc2b5f2d43e7ad672c4cff7c105933327d42 (patch) | |
| tree | f86e37afcf8525d6ec546f5c3f1e9ce658930ba0 | |
| parent | 624dc17de6964261f8e5906a62519f5a18219a08 (diff) | |
| download | perlweeklychallenge-club-5c93fc2b5f2d43e7ad672c4cff7c105933327d42.tar.gz perlweeklychallenge-club-5c93fc2b5f2d43e7ad672c4cff7c105933327d42.tar.bz2 perlweeklychallenge-club-5c93fc2b5f2d43e7ad672c4cff7c105933327d42.zip | |
Task 1 Week 348 in Raku by @ash
| -rw-r--r-- | challenge-348/ash/raku/ch-1.raku | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-348/ash/raku/ch-1.raku b/challenge-348/ash/raku/ch-1.raku new file mode 100644 index 0000000000..357735f0cb --- /dev/null +++ b/challenge-348/ash/raku/ch-1.raku @@ -0,0 +1,22 @@ +# Task 1 of The Weekly Challenge 348 +# https://theweeklychallenge.org/blog/perl-weekly-challenge-348/#TASK1 + +say can-split 'textbook'; # False +say can-split 'book'; # True +say can-split 'AbCdEfGh'; # True +say can-split 'rhythmmyth'; # False +say can-split 'UmpireeAudio'; # False + +say can-split 'odd'; # False + +sub can-split($str) { + return False if $str.chars % 2; + + my $len = ($str.chars / 2).Int; + my ($a, $b) = $str.comb($len); + + $a ~~ s:g:i/<-[aeiou]>+//; + $b ~~ s:g:i/<-[aeiou]>+//; + + return $a.chars == $b.chars != 0; +} |
