AoC2022/d03/src/main.rs
2022-12-11 18:06:33 +01:00

42 lines
600 B
Rust

use std::io::BufRead;
mod a1;
mod a2;
fn read_file(path :&str) -> Vec<String> {
let file = std::fs::File::open(path);
return match file {
Ok(handle) => {
let reader = std::io::BufReader::new(handle);
let mut vec : Vec<String> = vec![];
reader.lines().for_each(|elem| {
vec.push(elem.unwrap());
});
vec
}
Err(_) => vec![]
}
}
fn main() {
let inp :Vec<String> = read_file("input.txt");
a1::run(inp.clone());
a2::run(inp);
}