I only found my edge case (and dumb implementation mistake, I guess) by forking a "working solution" from someone else, outputting their solution for each line, then diffing that with a similar output from mine. It took me a lot of debugging and troubleshooting.
Once I diffed it against a working output it was clear and solved within minutes.
Once I diffed it against a working output it was clear and solved within minutes.