regex-based solution for 4-2

master
Valentin Ochs 2020-12-05 09:27:46 +01:00
parent 58c3a85c29
commit 56a890f392
1 changed files with 3 additions and 0 deletions

3
04-2-2.py Normal file
View File

@ -0,0 +1,3 @@
import re
m=lambda x:None!=re.match(r'(by.:(1...|200[0-2])|iyr:20(1.|20)|eyr:20(2.|30)|hgt:..(in|.cm)|hc.:#.{6}|ec.:..[buynlh]|pi.:.{9})$',x)
print(sum(map(lambda x:(lambda x:6<sum(map(m,x)))(x.split()),open(0).read().split("\n\n"))))