30 lines
445 B
Rust
30 lines
445 B
Rust
|
|
||
|
|
||
|
pub fn run(inp :Vec<String>) {
|
||
|
|
||
|
let mut max = 0;
|
||
|
let mut curr_max = 0;
|
||
|
|
||
|
inp.iter().for_each(|elem| {
|
||
|
|
||
|
let number = elem.parse::<i32>();
|
||
|
|
||
|
match number {
|
||
|
Ok(n) => {
|
||
|
curr_max += n;
|
||
|
}
|
||
|
|
||
|
|
||
|
Err(_) => {
|
||
|
curr_max = 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if curr_max > max {
|
||
|
max = curr_max;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
println!("a1: {}", max);
|
||
|
|
||
|
}
|