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