From 72965b7680c521fca93e36624f83ac9065460f0e Mon Sep 17 00:00:00 2001 From: Valentin Ochs Date: Fri, 4 Dec 2020 11:57:42 +0100 Subject: [PATCH] Remove replace, simplify split --- 04-2-1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04-2-1.py b/04-2-1.py index fa184df..9b023a9 100644 --- a/04-2-1.py +++ b/04-2-1.py @@ -1,2 +1,2 @@ u=lambda x:7==sum(map(lambda y:len(y)>5 and{'by':lambda x:1920<=int(x)<=2002,'iy':lambda x:2010<=int(x)<=2020,'ey':lambda x:2020<=int(x)<=2030,'hg':lambda x:(x[-1]=='m'and 150<=int(x[:-2])<=193)or(x[-1]=='n'and 59<=int(x[:-2])<=76),'hc':lambda x:x[0]=='#'and len(x)==7 and int(x[1:],16)>=0,'ec':lambda x:x in'ambblubrngrygrnhzloth','pi':lambda x:len(x)==9,'ci':lambda x:False}[y[:2]](y[4:]),x)) -print(sum(map(lambda x:u(x.replace('\n',' ').split(' ')),open("/dev/stdin").read().split("\n\n")))) +print(sum(map(lambda x:u(x.split()),open("/dev/stdin").read().split("\n\n"))))