blob: 1ed2b067a19d90b034e73180a746662f6da5ab75 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
use std::{fs, io::Read};
pub mod prelude {
pub use std::error::Error;
}
pub fn read_input(day: usize) -> String {
let mut s = String::new();
let path = if let Some(arg) = std::env::args().nth(1) {
if arg == "-" {
std::io::stdin().read_to_string(&mut s).unwrap();
return s;
}
arg
} else {
format!("day{}/input", day)
};
fs::read_to_string(path).expect("Could not read input")
}
|