Implement day 19 part 1 in Terraform

This commit is contained in:
2024-12-19 23:24:11 +01:00
parent dd07090056
commit fdaadfe184
3 changed files with 39 additions and 0 deletions

13
2024/bonus/day19/main.tf Normal file
View File

@@ -0,0 +1,13 @@
variable "input" {
type = string
}
locals {
parts = split("\n\n", chomp((var.input)))
patterns = replace(local.parts[0], ", ", "|")
valid = [for line in split("\n", local.parts[1]) : line if length(regexall("^(${local.patterns})+$", line)) > 0]
}
output "part1" {
value = length(local.valid)
}