my_input = open("inputs/input4", "r").read().splitlines() p1 = 0 p2 = 0 p3 = 0 for line in my_input: for c in line: p1 += ord(c) - 64 for i in range(len(line) // 10): p2 += ord(line[i]) - 64 p2 += ord(line[-(i+1)]) - 64 for c in str(len(line) - (len(line) // 10) * 2): p2 += int(c) p3_line = "" run = 1 l_c = "" for c in line: if c == l_c: run += 1 else: if l_c != "": p3_line += str(run) + l_c l_c = c run = 1 p3_line += str(run) + l_c for c in p3_line: if c in "1234567890": p3 += int(c) else: p3 += ord(c) - 64 print(p1) print(p2) print(p3)