42 lines
600 B
Rust
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);
|
|
|
|
}
|