1use std::str::FromStr;
2use std::io;
3
4pub fn read_and_parse<T: FromStr>() -> Result<T, T::Err> {
5 let mut to_as_str = String::new();
6
7 io::stdin()
8 .read_line(&mut to_as_str)
9 .expect("Failed to read line");
10
11 return to_as_str.trim().parse();
12}