diff --git a/day01/src/lib.rs b/day01/src/lib.rs index c9442d9..3ccd595 100644 --- a/day01/src/lib.rs +++ b/day01/src/lib.rs @@ -20,15 +20,20 @@ struct Position { pub fn parse_input(input: &str) -> Vec { input - .split(", ") - .map(|item| { - let num = item[1..].parse::().unwrap(); - match &item[0..1] { - "L" => Move::Left(num), - "R" => Move::Right(num), - _ => panic!("invalid"), - } + .lines() + .map(|line| { + line.split(", ") + .map(|item| { + let num = item[1..].parse::().unwrap(); + match &item[0..1] { + "L" => Move::Left(num), + "R" => Move::Right(num), + _ => panic!("invalid"), + } + }) + .collect::>() }) + .flatten() .collect() }