1use std::io;
2use std::str::FromStr;
3
4pub fn scann<T: FromStr>() -> T where <T as FromStr>::Err: std::fmt::Debug {
7 let mut number = String::new();
8
9 io::stdin().read_line(&mut number).expect("IO error");
10
11 number.trim().parse::<T>().expect("Input error")
12}
13
14pub fn scanvec<T: FromStr>() -> Vec<T> where <T as FromStr>::Err: std::fmt::Debug {
17 let mut vec = String::new();
18
19 io::stdin().read_line(&mut vec).expect("IO error");
20
21 let vec = vec
22 .split_whitespace()
23 .map(|x| x.parse::<T>().expect("Parse error"))
24 .collect::<Vec<T>>();
25
26 vec
27}
28
29pub fn scanln() -> String {
32 let mut string = String::new();
33
34 io::stdin().read_line(&mut string).expect("IO ERROR");
35
36 let trim: &[_] = &['\n', '\r'];
37 string.trim_end_matches(trim).to_owned()
38}