Resolve day 5

main
Guillaume Dott 2021-11-23 13:04:49 +01:00
parent 93fba22c67
commit 3a34a3b4c4
2 changed files with 1022 additions and 0 deletions

1000
05/input 100644

File diff suppressed because it is too large Load Diff

22
05/script.rb 100755
View File

@ -0,0 +1,22 @@
#!/usr/bin/env ruby
require_relative '../common'
def part1(input)
input.select do |string|
string.count('aeiou') >= 3 && string.match?(/(.)\1/) && !string.match?(/ab|cd|pq|xy/)
end.size
end
def part2(input)
input.select do |string|
string.match?(/(..).*\1/) && string.match?(/(.).\1/)
end.size
end
input = Input.new(__dir__).readlines
puts "=== Part 1 ==="
puts part1(input)
puts "=== Part 2 ==="
puts part2(input)