From 0c4376d50379f41e3ae9a9ce54174b89697a28ff Mon Sep 17 00:00:00 2001 From: Candygoblen123 Date: Wed, 6 Dec 2023 11:03:00 -0500 Subject: [PATCH] day6 part2 rev --- day6/src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/day6/src/main.rs b/day6/src/main.rs index f3f6072..babcee7 100644 --- a/day6/src/main.rs +++ b/day6/src/main.rs @@ -6,10 +6,11 @@ fn main() { .map(|line| { &line[line.find(':').unwrap() + 1..] // Drop "Time:" and "Distance:" }).map(|line| { - line.split_whitespace().flat_map(|s| s.chars()).collect::() // Split the numbers into their own elements. - }) - .map(|num| num.parse::().expect("Couldn't parse number")) // Parse numbers into i32 - .collect(); // collect into Vec + line.split_whitespace() // Split the numbers into their own elements + .flat_map(|s| s.chars()).collect::() // Combine the strings into a single one + }).map(|num| { + num.parse::().expect("Couldn't parse number") // Parse numbers into i32 + }).collect(); // Collect into Vec let time = input[0];