This is an Advent of Code solution. Click to reveal!