blob: 637b4e3ed558c37f643fe9e733d2abc366e6c5c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
use itertools::Itertools;
fn main() {
let input: String = include_str!("../../input").to_string();
let mut calories: Vec<usize> = Vec::new();
for (key, group) in &input.lines().group_by(|line| *line != "") {
if key {
calories.push(group.into_iter().map(|i| i.parse::<usize>().unwrap()).sum());
}
}
println!("{}", calories.iter().max().unwrap());
}
|