AoC 2022, day 4

Run Settings
LanguageRaku
Language Version
Run Command
my ($cnt-p1, $cnt-p2) = 0, 0; for $*IN.lines.map({ .comb(/\d+/)».Int }) -> (\a0, \a1, \b0, \b1) { my @A = a0..a1; my @B = b0..b1; my \union-size = @A (|) @B; ++$cnt-p1 if union-size == +@A | +@B; ++$cnt-p2 if union-size < +@A + +@B; } put 'part 1: ', $cnt-p1; put 'part 2: ', $cnt-p2;
Editor Settings
Theme
Key bindings
Full width
Lines