diff options
Diffstat (limited to '08/src/part-1.rs')
-rw-r--r-- | 08/src/part-1.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/08/src/part-1.rs b/08/src/part-1.rs new file mode 100644 index 0000000..e477335 --- /dev/null +++ b/08/src/part-1.rs @@ -0,0 +1,23 @@ +mod bitfield; + +use std::io::{BufRead}; + +use crate::bitfield::{Bitfield, parse_input}; + +pub fn main() { + let mut stdin = std::io::stdin(); + let mut handle = stdin.lock(); + + let mut count_1478 = 0; + for line in handle.lines() { + let (all, output) = parse_input(& line.unwrap()); + for x in output { + let n = x.pop_count(); + if n == 2 || n == 3 || n == 4 || n == 7 { + count_1478 += 1; + } + } + } + + println!("The numbers 1, 4, 7, 8 occured {} times in the output.", count_1478); +} |