From f00c25db26dee3014189816b1cd80fe5308d9745 Mon Sep 17 00:00:00 2001 From: DUEFON Date: Mon, 5 Dec 2022 19:50:37 +0100 Subject: [PATCH] 3 pt 1 --- three.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 three.py diff --git a/three.py b/three.py new file mode 100755 index 0000000..39f77f9 --- /dev/null +++ b/three.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +from useful import * + +def stuff(l): + d = {x: True for x in l[:len(l)//2]} + return next(x for x in l[len(l)//2:] if d.get(x)) + +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))))