aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-097/luca-ferrari/raku/ch-2.p620
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-097/luca-ferrari/raku/ch-2.p6 b/challenge-097/luca-ferrari/raku/ch-2.p6
new file mode 100644
index 0000000000..7746228800
--- /dev/null
+++ b/challenge-097/luca-ferrari/raku/ch-2.p6
@@ -0,0 +1,20 @@
+#!raku
+
+
+sub MAIN( Str $B = "101100101",
+ Int $S = 3 ) {
+
+ my @splits = $B.comb: $S.Int;
+ my $flips = 0;
+
+ my ( $a, $b ) = @splits[ 0 ], Nil;
+
+ for 1 ..^ @splits.elems {
+ $b = @splits[ $_ ];
+
+ # find out how many chars are different
+ $flips++ if ( $a.comb[ $_ ] != $b.comb[ $_ ] ) for ^@$a.comb.elems;
+ }
+
+ say $flips;
+}