static INPUT: &'static str = include_str!("one.txt"); fn main() { let valueified = INPUT.chars().map(|c| match c { '(' => 1, ')' => -1, _ => 0}); let floor_number: i32 = valueified.clone().sum(); println!("Floor number: {floor_number}"); let mut floor = 0; let basement_index = valueified.take_while(|i| {floor += i; floor >= 0}).count() + 1; println!("First character in basement: {basement_index}"); }