diff options
Diffstat (limited to '2022/day1/part1')
-rw-r--r-- | 2022/day1/part1/src/main.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/2022/day1/part1/src/main.rs b/2022/day1/part1/src/main.rs index 637b4e3..a177d98 100644 --- a/2022/day1/part1/src/main.rs +++ b/2022/day1/part1/src/main.rs | |||
@@ -4,7 +4,7 @@ fn main() { | |||
4 | let input: String = include_str!("../../input").to_string(); | 4 | let input: String = include_str!("../../input").to_string(); |
5 | let mut calories: Vec<usize> = Vec::new(); | 5 | let mut calories: Vec<usize> = Vec::new(); |
6 | 6 | ||
7 | for (key, group) in &input.lines().group_by(|line| *line != "") { | 7 | for (key, group) in &input.lines().group_by(|line| line.is_empty()) { |
8 | if key { | 8 | if key { |
9 | calories.push(group.into_iter().map(|i| i.parse::<usize>().unwrap()).sum()); | 9 | calories.push(group.into_iter().map(|i| i.parse::<usize>().unwrap()).sum()); |
10 | } | 10 | } |