From 8a21dc82f93b8c5aa8eb56ff30be92485bf3da5e Mon Sep 17 00:00:00 2001 From: Candygoblen123 Date: Sat, 2 Dec 2023 22:18:39 -0500 Subject: [PATCH] update day2part2 --- day2/src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/day2/src/main.rs b/day2/src/main.rs index 39a1499..907bd3e 100644 --- a/day2/src/main.rs +++ b/day2/src/main.rs @@ -7,8 +7,17 @@ fn main() { for line in input { let split:Vec<_> = line.split(':').collect(); let rounds: Vec<_> = split.last().unwrap().split(';').collect(); - let rounds: Vec<_> = rounds.iter().map(|x| x.split(',').collect::>()).collect(); - let rounds: Vec<_> = rounds.iter().map(|x| x.iter().map(|x| x.trim().split(' ').collect::>()).collect::>()).collect(); + let rounds: Vec<_> = rounds.iter() + .map(|x| { + x.split(',').collect::>() + }).collect(); + + let rounds: Vec<_> = rounds.iter() + .map(|x| { + x.iter().map(|x| { + x.trim().split(' ').collect::>() + }).collect::>() + }).collect(); let (mut r_max, mut g_max, mut b_max) = (0, 0, 0); for round in rounds { for set in round {