From cb31906e36585adb7ac5d486e7e200f199073069 Mon Sep 17 00:00:00 2001 From: Simon Proctor Date: Mon, 5 Oct 2020 09:23:28 +0100 Subject: Challenge 1 : String roots --- challenge-081/simon-proctor/raku/ch-1.raku | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 challenge-081/simon-proctor/raku/ch-1.raku diff --git a/challenge-081/simon-proctor/raku/ch-1.raku b/challenge-081/simon-proctor/raku/ch-1.raku new file mode 100644 index 0000000000..951677af6e --- /dev/null +++ b/challenge-081/simon-proctor/raku/ch-1.raku @@ -0,0 +1,13 @@ +#!/usr/bin/env raku + +use v6; + +#| Given two strings find the common root strings +sub MAIN ( Str $a, Str $b ) { + .say for ( get-roots($a) (&) get-roots($b) ).keys; +} + +sub get-roots( Str $a ) { + ($a ~~ m:ex/^ (.+?) $0* $/).map(*[0].Str); +} + -- cgit