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 {