aoc2017-day07

Run Settings
LanguagePython
Language Version
Run Command
import sys import re input = sys.stdin.read() lines = input.split("\n") msuccs = {} mwei = {} for line in lines: line = re.sub("[-(),><]", "", line) w = line.split() src = w[0] wei = int(w[1]) succs = w[2:] msuccs[src] = succs mwei[src] = wei parents = {} for root in msuccs: for n in msuccs[root]: parents[n] = root root = list(filter(lambda x: x not in parents, msuccs))[0] print(root)
Editor Settings
Theme
Key bindings
Full width
Lines