blob: a177d98d1255373f193758e7b1702cbc074cf74d (
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.is_empty()) {
if key {
calories.push(group.into_iter().map(|i| i.parse::<usize>().unwrap()).sum());
}
}
println!("{}", calories.iter().max().unwrap());
}
|