diff --git a/2024/ruby/day_19.rb b/2024/ruby/day_19.rb new file mode 100644 index 0000000..ae885b0 --- /dev/null +++ b/2024/ruby/day_19.rb @@ -0,0 +1,18 @@ +available, desired = DATA.read.split("\n\n") +available = available.split(", ") +desired = desired.lines(chomp: true) + +available = Regexp.new("^(#{available.join(?|)})+$") +pp desired.select { _1 =~ available }.size + +__END__ +r, wr, b, g, bwu, rb, gb, br + +brwrr +bggr +gbbr +rrbgbr +ubwu +bwurrg +brgr +bbrgwb