Expand description
§Internet Protocol Version 7
It’s faster to treat the entire input as one big stream, using line breaks to increment the count if an address is valid.
For part two there are at most 26 * 26 = 676 possible ABA or BAB sequences so we can use a fixed size array to keep track of which ones we’ve seen for the current address so far.