This was a funky one. Pretty easy for part 1. Just trimming, splitting, and parsing all the numbers and operators and grouping them columnwise. Nothing too hard.
Part 2 was awkward. I always am a bit flustered when I have to go back and parse the input differently, especially because I build things around FromStr in Rust, so I have to do either a Part2Input for the second part or a separate parsing function. This one was fiddly because I tried to parse it into the same Input structure as before, but that didn't work because not all the equations had the same quantity of numbers this time. I also wanted to do some sort of zip that let me zip over an iterator of iterators, but I couldn't find a good way of zipping a dynamic number of iterators, even in itertools (it has multizip, but that only works on a compiletime number of iterators). In the end, I needed to do this awkward loop:
number_buffer.clear();
for number_line_iterator in &mut number_line_iterators {
match number_line_iterator.next() {
Some(digit) => number_buffer.push(digit),
None => {
equations.push(Equation {
numbers: numbers,
operator: operators.next().unwrap(),
});
break 'outer;
}
}
}
Not the prettiest, but it did get the job done.
#AdventOfCode #AdventOfCode2025 #AdventOfCode2025Day6 #AdventOfCode2025Day06 #Day6 #Day06 #Rust #RustLang #Programming #codingchallenges


