advent-of-code

advent of code attempts
git clone git://bvnf.space/advent-of-code.git
Log | Files | Refs

commit ded437a4a7e4dc99209d9412a9351bab2107f69a
parent 36fc7eb8864bdc0b36c96e4c330847f9bfb46ec7
Author: aabacchus <ben@bvnf.space>
Date:   Tue,  6 Dec 2022 13:44:44 +0000

22.3.2

Diffstat:
M2022/03/a.py | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/2022/03/a.py b/2022/03/a.py @@ -11,3 +11,12 @@ for line in x: total += "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".index(char) + 1 break print(total) + +total = 0 +for i in range(0, len(l), 3): + common = set(l[i]) & set(l[i+1]) & set(l[i+2]) + if (len(common) != 1): + print("ERROR", common) + total += "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".index(list(common)[0]) + 1 + i += 3 +print(total)