diff --git a/2024/ruby/day_03.rb b/2024/ruby/day_03.rb new file mode 100644 index 0000000..d307b67 --- /dev/null +++ b/2024/ruby/day_03.rb @@ -0,0 +1,9 @@ +input = DATA.read + .gsub(/don't\(\)(?~do\(\))do\(\)/, "") # part two + .scan(/mul\((\d+),(\d+)\)/) + .map { _1.map(&:to_i) } + +pp input.sum { _1 * _2 } + +__END__ +xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))