3 2
This commit is contained in:
parent
f00c25db26
commit
e0b63fb15a
12
three.py
12
three.py
|
@ -9,5 +9,13 @@ def points(c):
|
|||
o = ord(c)
|
||||
return 27 + o - ord('A') if o < ord('a') else 1 + o - ord('a')
|
||||
|
||||
#ic([points(stuff(l)) for l in lines(open(0))])
|
||||
print(sum(points(stuff(l)) for l in lines(open(0))))
|
||||
def twuff(trip):
|
||||
d = [{x: True for x in l} for l in trip[:2]]
|
||||
return next(c for c in trip[2] if c in d[0] and c in d[1])
|
||||
|
||||
def trips(ls):
|
||||
return [[ls[i], ls[i+1], ls[i+2]] for i in range(0, len(ls), 3)]
|
||||
|
||||
ls = lines(open(0))
|
||||
print(sum(points(stuff(l)) for l in ls))
|
||||
print(sum(points(twuff(l)) for l in trips(ls)))
|
||||
|
|
Loading…
Reference in New Issue