mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
14 lines
312 B
HCL
14 lines
312 B
HCL
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)
|
|
}
|