Advent-of-Code/2020/day 4/P1/passport_processing.py
2020-12-04 11:42:51 +01:00

13 lines
441 B
Python

print(
len(
list(
filter(
lambda x: all(y in [e[1] for e in x] for y in ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]),
map(
lambda x: __import__("re").findall(r"((byr|iyr|eyr|hgt|hcl|ecl|pid|cid):([a-zA-Z0-9#]+))", x),
[m.replace("\n", " ") for m in open("input.txt").read().split("\n\n")]
)
)
)
)
)