From 6f462723400e909e0414524f4ab1232eee2537f1 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Wed, 18 Dec 2024 21:03:03 -0800 Subject: [PATCH] [2024][ruby][19.1] --- 2024/ruby/day_19.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 2024/ruby/day_19.rb 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