pub fn y15d01p1(input: &str) -> i32
Expand description
The solution for part one of the day one challenge.
Given the input as a string we loop through the characters and either add
one or subtract one from a counter that starts at zero depending on if the
character is a (
, or a )
, respectively.
§Example
let input = "(()))((\n"; // probably read this from the input file...
assert_eq!(y15d01p1(input), 1);