In general, the answers on AoC are very narrowly defined. Up until the end when exactly what they are looking for is defined, you don't have enough information to start thinking about how to solve the problem.
Usually the answer is a special case of what would be a more general approach to the real world problem.
Here the basic idea is to scan the text input file, and quickly process it.