#[path = "../lib.rs"] mod lib; fn parse_input() -> (Vec, Vec) { let mut locks = vec![]; let mut keys = vec![]; let mut value = 0; for (i, line) in lib::iter_input().enumerate() { match i % 8 { 6 => { if line.starts_with('.') { locks.push(value); } else { keys.push(value); } value = 0; } 0 | 7 => {} _ => { for b in line.bytes() { value <<= 1; if b == b'#' { value |= 1; } } } } } return (locks, keys); } fn main() { let (locks, keys) = parse_input(); let mut sum1 = 0; for lock in locks.iter() { for key in keys.iter() { if lock & key == 0 { sum1 += 1; } } } println!("part1: {}", sum1); }