Source: Day Day 5: Print Queue
Full solution for today (spoilers!).
Part 1
The input is a list of pairs of the form
a|b
which defines thatb
must not come beforea
, an empty line, and then a list of valuesa,b,c,d
.For each line that is valid for all given
a|b
rules, sum the middle number of each list.