|
@ -20,21 +20,31 @@ fn main() { |
|
|
|
|
|
|
|
|
let hms = Regex::new(r"(\d\d?)\|(\d\d)\|(\d\d)").unwrap();
|
|
|
let hms = Regex::new(r"(\d\d?)\|(\d\d)\|(\d\d)").unwrap();
|
|
|
let csv = Regex::new(r", ").unwrap();
|
|
|
let csv = Regex::new(r", ").unwrap();
|
|
|
|
|
|
let dig = Regex::new(r"\D+").unwrap();
|
|
|
|
|
|
|
|
|
let parse_int = |m: Option<Match>| {
|
|
|
let parse_int = |m: Option<Match>| {
|
|
|
m.unwrap().as_str().parse::<usize>().unwrap()
|
|
|
m.unwrap().as_str().parse::<usize>().unwrap()
|
|
|
};
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// let mut vec =
|
|
|
|
|
|
// hms.captures_iter(test)
|
|
|
|
|
|
// .map(|cap|
|
|
|
|
|
|
// cap.iter().skip(1)
|
|
|
|
|
|
// .map(parse_int)
|
|
|
|
|
|
// .collect::<Vec<usize>>()
|
|
|
|
|
|
// .chunks(3)
|
|
|
|
|
|
// .map(|c| (c[0],c[1],c[2]))
|
|
|
|
|
|
// .map(|(h,m,s)| h*3600 + m*60 +s)
|
|
|
|
|
|
// .sum())
|
|
|
|
|
|
// .collect::<Vec<usize>>();
|
|
|
|
|
|
|
|
|
let mut vec =
|
|
|
let mut vec =
|
|
|
hms.captures_iter(test)
|
|
|
|
|
|
.map(|cap|
|
|
|
|
|
|
cap.iter().skip(1)
|
|
|
|
|
|
.map(parse_int)
|
|
|
|
|
|
|
|
|
dig.split(test)
|
|
|
|
|
|
.map(|c| c.parse::<usize>().unwrap())
|
|
|
.collect::<Vec<usize>>()
|
|
|
.collect::<Vec<usize>>()
|
|
|
.chunks(3)
|
|
|
.chunks(3)
|
|
|
.map(|c| (c[0],c[1],c[2]))
|
|
|
.map(|c| (c[0],c[1],c[2]))
|
|
|
.map(|(h,m,s)| h*3600 + m*60 +s)
|
|
|
.map(|(h,m,s)| h*3600 + m*60 +s)
|
|
|
.sum())
|
|
|
|
|
|
.collect::<Vec<usize>>();
|
|
|
.collect::<Vec<usize>>();
|
|
|
|
|
|
|
|
|
vec.sort_unstable();
|
|
|
vec.sort_unstable();
|
|
|