update day2part2

This commit is contained in:
Candygoblen123 2023-12-02 22:18:39 -05:00
parent 29ff13fb86
commit 8a21dc82f9
No known key found for this signature in database
GPG Key ID: 577DA64EBEF10385

View File

@ -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::<Vec<_>>()).collect();
let rounds: Vec<_> = rounds.iter().map(|x| x.iter().map(|x| x.trim().split(' ').collect::<Vec<_>>()).collect::<Vec<_>>()).collect();
let rounds: Vec<_> = rounds.iter()
.map(|x| {
x.split(',').collect::<Vec<_>>()
}).collect();
let rounds: Vec<_> = rounds.iter()
.map(|x| {
x.iter().map(|x| {
x.trim().split(' ').collect::<Vec<_>>()
}).collect::<Vec<_>>()
}).collect();
let (mut r_max, mut g_max, mut b_max) = (0, 0, 0);
for round in rounds {
for set in round {