summaryrefslogtreecommitdiff
path: root/2023
diff options
context:
space:
mode:
Diffstat (limited to '2023')
-rw-r--r--2023/day06.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/2023/day06.rs b/2023/day06.rs
index 7ba165e..92a631a 100644
--- a/2023/day06.rs
+++ b/2023/day06.rs
@@ -40,19 +40,18 @@ fn main() {
.fold(1, |acc, x| acc * x);
let mut lines = content.trim_end().split('\n');
- let parse1 = |l: &str| {
+ let parse2 = |l: &str| {
l.split_once(":")
.unwrap()
.1
- .split(" ")
- .filter(|s| !s.is_empty())
+ .split_whitespace()
.collect::<Vec<_>>()
.join("")
- .parse::<u64>()
+ .parse()
.unwrap()
};
- let time = parse1(lines.next().unwrap());
- let dist = parse1(lines.next().unwrap());
+ let time = parse2(lines.next().unwrap());
+ let dist = parse2(lines.next().unwrap());
let res2 = get_opts(time, dist);
println!("res1: {}", res1);