diff options
Diffstat (limited to '2022')
| -rw-r--r-- | 2022/Rust/Cargo.toml | 5 | ||||
| -rw-r--r-- | 2022/Rust/data/day5.prod | 511 | ||||
| -rw-r--r-- | 2022/Rust/data/day5.test | 9 | ||||
| -rw-r--r-- | 2022/Rust/src/day1.rs | 17 | ||||
| -rw-r--r-- | 2022/Rust/src/day2.rs | 1 | ||||
| -rw-r--r-- | 2022/Rust/src/day3.rs | 3 | ||||
| -rw-r--r-- | 2022/Rust/src/day5.rs | 185 |
7 files changed, 719 insertions, 12 deletions
diff --git a/2022/Rust/Cargo.toml b/2022/Rust/Cargo.toml index 90ae026..fb7aa9e 100644 --- a/2022/Rust/Cargo.toml +++ b/2022/Rust/Cargo.toml @@ -23,3 +23,8 @@ path = "src/day3.rs" [[bin]] name = "day4" path = "src/day4.rs" + + +[[bin]] +name = "day5" +path = "src/day5.rs" diff --git a/2022/Rust/data/day5.prod b/2022/Rust/data/day5.prod new file mode 100644 index 0000000..87fde8f --- /dev/null +++ b/2022/Rust/data/day5.prod @@ -0,0 +1,511 @@ + [C] [N] [R] +[J] [T] [H] [P] [L] +[F] [S] [T] [B] [M] [D] +[C] [L] [J] [Z] [S] [L] [B] +[N] [Q] [G] [J] [J] [F] [F] [R] +[D] [V] [B] [L] [B] [Q] [D] [M] [T] +[B] [Z] [Z] [T] [V] [S] [V] [S] [D] +[W] [P] [P] [D] [G] [P] [B] [P] [V] + 1 2 3 4 5 6 7 8 9 + +move 4 from 9 to 6 +move 7 from 2 to 5 +move 3 from 5 to 2 +move 2 from 2 to 1 +move 2 from 8 to 4 +move 1 from 6 to 9 +move 1 from 9 to 4 +move 7 from 1 to 2 +move 5 from 2 to 3 +move 5 from 7 to 4 +move 5 from 6 to 3 +move 1 from 7 to 6 +move 2 from 6 to 9 +move 3 from 2 to 4 +move 4 from 5 to 6 +move 2 from 7 to 3 +move 2 from 9 to 3 +move 1 from 5 to 2 +move 11 from 4 to 3 +move 1 from 2 to 9 +move 1 from 9 to 3 +move 2 from 1 to 6 +move 5 from 8 to 5 +move 7 from 5 to 4 +move 2 from 5 to 6 +move 6 from 6 to 4 +move 17 from 3 to 4 +move 1 from 8 to 3 +move 11 from 4 to 7 +move 1 from 6 to 4 +move 3 from 4 to 2 +move 2 from 2 to 6 +move 8 from 3 to 1 +move 8 from 3 to 9 +move 3 from 9 to 6 +move 3 from 1 to 3 +move 11 from 7 to 5 +move 1 from 6 to 4 +move 4 from 9 to 6 +move 3 from 1 to 4 +move 1 from 2 to 3 +move 1 from 6 to 9 +move 24 from 4 to 9 +move 2 from 6 to 5 +move 1 from 1 to 2 +move 1 from 1 to 3 +move 12 from 9 to 6 +move 5 from 4 to 2 +move 4 from 2 to 3 +move 5 from 6 to 3 +move 13 from 6 to 7 +move 1 from 5 to 6 +move 9 from 5 to 3 +move 4 from 7 to 5 +move 1 from 6 to 1 +move 3 from 5 to 1 +move 14 from 9 to 4 +move 2 from 7 to 9 +move 13 from 4 to 9 +move 1 from 4 to 7 +move 4 from 7 to 9 +move 3 from 5 to 1 +move 8 from 3 to 9 +move 4 from 1 to 4 +move 8 from 3 to 7 +move 3 from 7 to 6 +move 4 from 4 to 2 +move 3 from 1 to 9 +move 6 from 2 to 6 +move 3 from 3 to 1 +move 7 from 9 to 7 +move 2 from 6 to 5 +move 1 from 5 to 3 +move 3 from 7 to 5 +move 5 from 7 to 4 +move 2 from 1 to 4 +move 5 from 5 to 9 +move 6 from 4 to 1 +move 6 from 7 to 8 +move 22 from 9 to 3 +move 7 from 1 to 8 +move 4 from 9 to 6 +move 1 from 4 to 5 +move 8 from 6 to 4 +move 7 from 8 to 1 +move 1 from 6 to 4 +move 1 from 9 to 4 +move 1 from 1 to 2 +move 1 from 2 to 5 +move 1 from 9 to 8 +move 11 from 3 to 7 +move 1 from 6 to 2 +move 2 from 1 to 5 +move 1 from 8 to 2 +move 1 from 7 to 8 +move 4 from 5 to 7 +move 1 from 6 to 9 +move 6 from 3 to 1 +move 6 from 3 to 1 +move 15 from 7 to 5 +move 1 from 3 to 1 +move 1 from 3 to 6 +move 1 from 6 to 8 +move 14 from 5 to 1 +move 16 from 1 to 3 +move 2 from 8 to 9 +move 1 from 7 to 4 +move 3 from 9 to 8 +move 3 from 8 to 7 +move 2 from 3 to 5 +move 1 from 7 to 1 +move 6 from 8 to 5 +move 2 from 2 to 9 +move 1 from 7 to 2 +move 2 from 9 to 2 +move 5 from 4 to 7 +move 3 from 2 to 7 +move 14 from 1 to 5 +move 2 from 4 to 7 +move 8 from 7 to 6 +move 1 from 1 to 5 +move 1 from 7 to 4 +move 1 from 7 to 5 +move 1 from 1 to 8 +move 12 from 3 to 4 +move 1 from 8 to 7 +move 3 from 4 to 1 +move 1 from 6 to 2 +move 8 from 5 to 2 +move 1 from 7 to 6 +move 1 from 1 to 7 +move 6 from 6 to 2 +move 1 from 1 to 2 +move 14 from 5 to 7 +move 1 from 6 to 4 +move 4 from 4 to 7 +move 1 from 1 to 6 +move 1 from 5 to 6 +move 2 from 3 to 1 +move 14 from 7 to 5 +move 10 from 4 to 7 +move 1 from 1 to 9 +move 1 from 5 to 9 +move 11 from 5 to 1 +move 6 from 7 to 6 +move 1 from 4 to 6 +move 1 from 3 to 7 +move 2 from 1 to 5 +move 13 from 2 to 1 +move 10 from 6 to 7 +move 4 from 5 to 2 +move 1 from 9 to 1 +move 1 from 3 to 6 +move 2 from 5 to 2 +move 1 from 9 to 3 +move 1 from 3 to 1 +move 21 from 7 to 5 +move 1 from 6 to 4 +move 4 from 5 to 1 +move 1 from 4 to 1 +move 6 from 2 to 3 +move 1 from 3 to 6 +move 1 from 3 to 8 +move 1 from 8 to 7 +move 1 from 7 to 3 +move 9 from 5 to 3 +move 24 from 1 to 4 +move 1 from 3 to 7 +move 11 from 3 to 8 +move 1 from 7 to 3 +move 1 from 2 to 4 +move 2 from 2 to 1 +move 2 from 3 to 5 +move 1 from 6 to 5 +move 10 from 4 to 6 +move 2 from 6 to 4 +move 5 from 1 to 2 +move 1 from 6 to 7 +move 8 from 8 to 6 +move 4 from 2 to 7 +move 8 from 6 to 7 +move 1 from 2 to 8 +move 1 from 8 to 3 +move 1 from 7 to 4 +move 3 from 4 to 1 +move 2 from 6 to 7 +move 4 from 1 to 9 +move 3 from 6 to 7 +move 10 from 7 to 4 +move 2 from 3 to 9 +move 2 from 6 to 9 +move 2 from 1 to 8 +move 2 from 9 to 5 +move 4 from 5 to 6 +move 3 from 8 to 1 +move 4 from 4 to 8 +move 5 from 8 to 4 +move 1 from 8 to 2 +move 5 from 5 to 9 +move 1 from 6 to 1 +move 2 from 1 to 7 +move 22 from 4 to 8 +move 4 from 8 to 7 +move 2 from 6 to 7 +move 1 from 2 to 6 +move 16 from 8 to 9 +move 3 from 7 to 4 +move 1 from 5 to 9 +move 2 from 6 to 7 +move 1 from 8 to 2 +move 1 from 2 to 3 +move 24 from 9 to 3 +move 1 from 1 to 7 +move 3 from 5 to 1 +move 4 from 4 to 6 +move 15 from 3 to 6 +move 18 from 6 to 2 +move 3 from 3 to 2 +move 4 from 1 to 6 +move 4 from 7 to 3 +move 1 from 3 to 9 +move 4 from 2 to 1 +move 1 from 8 to 7 +move 3 from 9 to 6 +move 1 from 9 to 3 +move 4 from 7 to 3 +move 2 from 4 to 2 +move 1 from 1 to 2 +move 7 from 3 to 5 +move 8 from 6 to 1 +move 1 from 9 to 2 +move 3 from 7 to 5 +move 1 from 4 to 8 +move 3 from 1 to 7 +move 5 from 7 to 6 +move 3 from 5 to 2 +move 3 from 7 to 3 +move 5 from 5 to 9 +move 5 from 3 to 6 +move 1 from 8 to 3 +move 5 from 9 to 7 +move 7 from 2 to 4 +move 11 from 2 to 7 +move 7 from 1 to 6 +move 1 from 1 to 9 +move 5 from 3 to 6 +move 5 from 2 to 1 +move 1 from 3 to 9 +move 1 from 3 to 7 +move 6 from 6 to 2 +move 10 from 6 to 7 +move 5 from 6 to 7 +move 28 from 7 to 8 +move 2 from 9 to 1 +move 1 from 6 to 3 +move 4 from 7 to 5 +move 1 from 3 to 6 +move 7 from 2 to 7 +move 6 from 7 to 3 +move 1 from 5 to 9 +move 1 from 6 to 2 +move 1 from 7 to 3 +move 1 from 9 to 1 +move 4 from 5 to 2 +move 5 from 3 to 5 +move 2 from 2 to 8 +move 4 from 4 to 7 +move 1 from 4 to 7 +move 2 from 3 to 6 +move 5 from 7 to 1 +move 2 from 5 to 8 +move 2 from 5 to 8 +move 2 from 5 to 3 +move 2 from 3 to 1 +move 2 from 6 to 7 +move 31 from 8 to 3 +move 2 from 8 to 5 +move 2 from 7 to 4 +move 7 from 1 to 4 +move 2 from 5 to 1 +move 3 from 2 to 8 +move 2 from 4 to 6 +move 3 from 1 to 2 +move 6 from 4 to 8 +move 1 from 1 to 8 +move 1 from 6 to 5 +move 11 from 8 to 9 +move 1 from 6 to 8 +move 1 from 4 to 1 +move 1 from 8 to 7 +move 1 from 5 to 8 +move 3 from 2 to 1 +move 2 from 4 to 3 +move 1 from 8 to 1 +move 7 from 3 to 6 +move 12 from 3 to 2 +move 1 from 7 to 9 +move 4 from 6 to 1 +move 1 from 6 to 3 +move 12 from 9 to 3 +move 1 from 6 to 4 +move 1 from 1 to 7 +move 1 from 4 to 1 +move 1 from 7 to 2 +move 1 from 6 to 5 +move 1 from 5 to 6 +move 5 from 3 to 1 +move 1 from 6 to 4 +move 7 from 2 to 1 +move 3 from 2 to 6 +move 1 from 4 to 5 +move 3 from 3 to 2 +move 4 from 2 to 8 +move 1 from 6 to 4 +move 1 from 4 to 9 +move 1 from 5 to 1 +move 11 from 1 to 5 +move 10 from 1 to 8 +move 2 from 6 to 4 +move 1 from 2 to 9 +move 1 from 2 to 4 +move 18 from 3 to 5 +move 4 from 1 to 4 +move 3 from 1 to 2 +move 14 from 8 to 5 +move 2 from 2 to 6 +move 1 from 3 to 2 +move 2 from 2 to 7 +move 3 from 4 to 1 +move 2 from 4 to 3 +move 2 from 3 to 4 +move 2 from 6 to 9 +move 1 from 7 to 1 +move 3 from 1 to 4 +move 4 from 9 to 7 +move 31 from 5 to 2 +move 25 from 2 to 4 +move 13 from 4 to 2 +move 10 from 2 to 3 +move 2 from 5 to 7 +move 5 from 2 to 9 +move 7 from 5 to 7 +move 5 from 7 to 4 +move 1 from 5 to 8 +move 2 from 7 to 3 +move 11 from 4 to 8 +move 1 from 7 to 3 +move 1 from 1 to 4 +move 2 from 5 to 3 +move 3 from 2 to 9 +move 8 from 9 to 6 +move 10 from 8 to 2 +move 5 from 3 to 2 +move 1 from 7 to 3 +move 3 from 7 to 3 +move 15 from 2 to 1 +move 11 from 1 to 3 +move 1 from 8 to 2 +move 8 from 6 to 5 +move 1 from 2 to 6 +move 1 from 6 to 1 +move 12 from 3 to 7 +move 1 from 2 to 9 +move 2 from 4 to 1 +move 3 from 1 to 8 +move 1 from 8 to 7 +move 3 from 3 to 4 +move 1 from 4 to 7 +move 15 from 7 to 9 +move 1 from 7 to 5 +move 4 from 1 to 8 +move 6 from 8 to 6 +move 1 from 6 to 2 +move 5 from 5 to 1 +move 2 from 6 to 8 +move 1 from 2 to 7 +move 1 from 8 to 2 +move 1 from 7 to 1 +move 1 from 5 to 8 +move 6 from 3 to 1 +move 4 from 3 to 8 +move 7 from 8 to 5 +move 1 from 2 to 4 +move 2 from 4 to 2 +move 3 from 6 to 4 +move 5 from 9 to 3 +move 4 from 1 to 4 +move 10 from 5 to 9 +move 8 from 1 to 7 +move 1 from 2 to 1 +move 1 from 1 to 9 +move 20 from 9 to 2 +move 12 from 2 to 3 +move 17 from 4 to 3 +move 6 from 7 to 2 +move 5 from 3 to 8 +move 20 from 3 to 5 +move 2 from 9 to 4 +move 3 from 3 to 1 +move 1 from 7 to 1 +move 6 from 3 to 6 +move 4 from 2 to 3 +move 4 from 5 to 3 +move 1 from 1 to 9 +move 6 from 6 to 1 +move 3 from 8 to 4 +move 1 from 9 to 8 +move 2 from 2 to 1 +move 3 from 3 to 2 +move 1 from 3 to 6 +move 1 from 7 to 4 +move 3 from 3 to 6 +move 6 from 1 to 5 +move 9 from 2 to 4 +move 3 from 2 to 5 +move 2 from 6 to 5 +move 16 from 4 to 8 +move 18 from 8 to 6 +move 1 from 4 to 5 +move 2 from 6 to 7 +move 4 from 1 to 7 +move 22 from 5 to 6 +move 1 from 4 to 9 +move 4 from 7 to 6 +move 11 from 6 to 5 +move 9 from 5 to 2 +move 2 from 2 to 3 +move 2 from 7 to 2 +move 1 from 1 to 7 +move 9 from 6 to 2 +move 1 from 5 to 1 +move 1 from 8 to 9 +move 18 from 6 to 8 +move 1 from 7 to 4 +move 4 from 5 to 1 +move 2 from 5 to 2 +move 2 from 2 to 5 +move 1 from 9 to 5 +move 1 from 5 to 9 +move 1 from 9 to 1 +move 1 from 9 to 2 +move 1 from 4 to 8 +move 4 from 1 to 4 +move 2 from 6 to 5 +move 1 from 1 to 9 +move 3 from 6 to 7 +move 1 from 6 to 9 +move 1 from 9 to 8 +move 2 from 5 to 9 +move 3 from 3 to 5 +move 7 from 2 to 3 +move 1 from 1 to 3 +move 2 from 5 to 9 +move 1 from 5 to 7 +move 10 from 8 to 3 +move 10 from 8 to 9 +move 3 from 4 to 3 +move 9 from 2 to 1 +move 4 from 9 to 6 +move 5 from 1 to 9 +move 2 from 5 to 9 +move 1 from 6 to 4 +move 4 from 7 to 2 +move 7 from 2 to 9 +move 3 from 6 to 8 +move 1 from 1 to 3 +move 2 from 8 to 5 +move 1 from 8 to 1 +move 18 from 3 to 6 +move 15 from 9 to 2 +move 8 from 9 to 1 +move 2 from 9 to 2 +move 2 from 4 to 9 +move 2 from 9 to 7 +move 12 from 6 to 3 +move 7 from 1 to 7 +move 12 from 2 to 5 +move 7 from 3 to 2 +move 4 from 3 to 4 +move 2 from 7 to 6 +move 7 from 7 to 8 +move 1 from 4 to 2 +move 4 from 1 to 8 +move 5 from 3 to 1 +move 9 from 8 to 3 +move 1 from 8 to 7 +move 2 from 1 to 2 +move 4 from 6 to 7 +move 11 from 2 to 5 +move 2 from 4 to 6 +move 1 from 8 to 2 +move 7 from 3 to 2 +move 1 from 2 to 4 +move 4 from 6 to 1 +move 7 from 5 to 8 +move 2 from 3 to 1 +move 7 from 2 to 3 +move 6 from 5 to 1 +move 1 from 4 to 2 +move 8 from 1 to 6 +move 3 from 2 to 9 diff --git a/2022/Rust/data/day5.test b/2022/Rust/data/day5.test new file mode 100644 index 0000000..84933bb --- /dev/null +++ b/2022/Rust/data/day5.test @@ -0,0 +1,9 @@ + [D] +[N] [C] +[Z] [M] [P] + 1 2 3 + +move 1 from 2 to 1 +move 3 from 1 to 3 +move 2 from 2 to 1 +move 1 from 1 to 2 diff --git a/2022/Rust/src/day1.rs b/2022/Rust/src/day1.rs index 7c5c413..f5a4cb9 100644 --- a/2022/Rust/src/day1.rs +++ b/2022/Rust/src/day1.rs @@ -2,21 +2,18 @@ fn solve_part_one(data: &str) -> u32 { data.split("\n\n") .collect::<Vec<&str>>() .iter() - .map(|line| { - line.split("\n") - .flat_map(|x| x.parse::<u32>()).sum::<u32>() - }) - .max().unwrap() + .map(|line| line.split("\n").flat_map(|x| x.parse::<u32>()).sum::<u32>()) + .max() + .unwrap() } fn solve_part_two(data: &str) -> u32 { - let mut vec = data.split("\n\n") + let mut vec = data + .split("\n\n") .collect::<Vec<&str>>() .iter() - .map(|line| { - line.split("\n") - .flat_map(|x| x.parse::<u32>()).sum::<u32>() - }).collect::<Vec<u32>>(); + .map(|line| line.split("\n").flat_map(|x| x.parse::<u32>()).sum::<u32>()) + .collect::<Vec<u32>>(); vec.sort_by(|a, b| b.cmp(a)); vec.iter().take(3).sum() } diff --git a/2022/Rust/src/day2.rs b/2022/Rust/src/day2.rs index e69de29..8b13789 100644 --- a/2022/Rust/src/day2.rs +++ b/2022/Rust/src/day2.rs @@ -0,0 +1 @@ + diff --git a/2022/Rust/src/day3.rs b/2022/Rust/src/day3.rs index cb8db12..8a6c289 100644 --- a/2022/Rust/src/day3.rs +++ b/2022/Rust/src/day3.rs @@ -27,7 +27,7 @@ fn solve_part_two(data: &str) -> u32 { vecs.chunks(3) .map(|x| -> u32 { - let mut acc : u32 = 0; + let mut acc: u32 = 0; for i in x[0] .iter() .filter(|ch| x[1].contains(ch)) @@ -44,7 +44,6 @@ fn solve_part_two(data: &str) -> u32 { .sum() } - fn main() { let data = include_str!("../data/day3.prod"); println!("{}", solve_part_one(data)); diff --git a/2022/Rust/src/day5.rs b/2022/Rust/src/day5.rs new file mode 100644 index 0000000..12ff7a8 --- /dev/null +++ b/2022/Rust/src/day5.rs @@ -0,0 +1,185 @@ +use std::{collections::VecDeque, num::ParseIntError, str::FromStr}; + +const STACK_ELEMENT_WIDTH: usize = 3; +const STACKS_SIZE: usize = 9; + +#[derive(Debug, Clone)] +struct Stack { + stack: VecDeque<StackElement>, +} + +impl FromStr for Stack { + type Err = ParseIntError; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + Ok(Stack { + stack: s + .lines() + .map(|line| line.parse::<StackElement>().unwrap()) + .collect::<VecDeque<_>>(), + }) + } +} + +impl Stack { + fn new() -> Self { + Stack { + stack: VecDeque::new(), + } + } +} + +#[derive(Debug, Clone)] +struct StackElement { + ele: char, +} + +impl FromStr for StackElement { + type Err = ParseIntError; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + let ch = s.chars().nth(1).unwrap(); + Ok(StackElement { ele: ch }) + } +} + +#[derive(Debug)] +struct Command { + num_of_times: usize, + from: usize, + target: usize, +} + +impl FromStr for Command { + type Err = ParseIntError; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + let s: Vec<usize> = s + .split_whitespace() + .collect::<Vec<_>>() + .iter() + .filter(|c| c.bytes().all(|c| c.is_ascii_digit())) + .map(|n| n.parse().unwrap()) + .collect(); + let (num_of_times, from, target) = (s[0], s[1], s[2]); + Ok(Command { + num_of_times, + from, + target, + }) + } +} + +fn apply_command(stacks: &mut Vec<Stack>, cmd: &Command, part1: bool) { + if part1 { + for _ in 0..cmd.num_of_times { + let element_to_push = stacks[cmd.from - 1].stack.pop_back().expect("welp the stack is empty"); + stacks[cmd.target - 1].stack.push_back(element_to_push); + } + } else { + let mut tmp_stack :VecDeque<StackElement> = VecDeque::new(); + for _ in 0..cmd.num_of_times { + let element_to_push = stacks[cmd.from - 1].stack.pop_back().expect("welp the stack is empty"); + tmp_stack.push_back(element_to_push); + } + for _ in 0..cmd.num_of_times { + stacks[cmd.target - 1].stack.push_back(tmp_stack.pop_back().unwrap()); + } + } +} + +fn solve_part_one(data: &str) -> String { + let mut stacks: Vec<Stack> = vec![Stack::new(); STACKS_SIZE]; + let stack = data.split("\n\n").nth(0).unwrap(); + for x in stack.lines() { + let chars = x.chars().clone(); + for (i, ch) in x.chars().enumerate() { + if ch == '[' { + stacks[i / 4].stack.push_front( + chars.as_str()[i..i + STACK_ELEMENT_WIDTH] + .parse::<StackElement>() + .unwrap(), + ) + } + } + } + let commands: Vec<Command> = data + .split("\n\n") + .nth(1) + .unwrap() + .lines() + .map(|command| command.parse::<Command>().unwrap()) + .collect(); + + for cmd in &commands { + apply_command(&mut stacks, cmd, true); + } + + let mut ans = "".to_string(); + for i in 0..STACKS_SIZE { + if stacks[i].stack.len() >= 1 { + ans += stacks[i] + .stack + .iter() + .last() + .unwrap() + .ele + .to_string() + .as_str(); + } + } + ans +} + +fn solve_part_two(data: &str) -> String { + let mut stacks: Vec<Stack> = vec![Stack::new(); STACKS_SIZE]; + let stack = data.split("\n\n").nth(0).unwrap(); + for x in stack.lines() { + let chars = x.chars().clone(); + for (i, ch) in x.chars().enumerate() { + if ch == '[' { + stacks[i / 4].stack.push_front( + chars.as_str()[i..i + STACK_ELEMENT_WIDTH] + .parse::<StackElement>() + .unwrap(), + ) + } + } + } + let commands: Vec<Command> = data + .split("\n\n") + .nth(1) + .unwrap() + .lines() + .map(|command| command.parse::<Command>().unwrap()) + .collect(); + + for cmd in &commands { + apply_command(&mut stacks, cmd, false); + } + + let mut ans = "".to_string(); + for i in 0..STACKS_SIZE { + if stacks[i].stack.len() >= 1 { + ans += stacks[i] + .stack + .iter() + .last() + .unwrap() + .ele + .to_string() + .as_str(); + } + } + ans +} + +fn main() { + let data_test = include_str!("../data/day5.test"); + let data_prod = include_str!("../data/day5.prod"); + + println!("part one test: {}", solve_part_one(data_test)); + println!("part one prod: {}", solve_part_one(data_prod)); + println!("part two test: {}", solve_part_two(data_test)); + println!("part two prod: {}", solve_part_two(data_prod)); +} |
