#![feature(slice_group_by)] use itertools::Itertools; use itertools::max; use std::fs; use anyhow::Result; fn main() -> Result<()> { let input = fs::read_to_string("input/01.txt")?; let groups = input .split("\n").collect::>() .into_iter() .group_by(|ell| *ell != ""); let elves = groups .into_iter() .filter(|(key, _)| *key) .map(|(_, elf)| elf .into_iter() .map(|val| val.parse::().unwrap()) .fold(0, |acc, val| acc + val) ); let highest = max(elves); println!("{:?}", highest); return Ok(()); }