about summary refs log tree commit diff
path: root/aoc/2021/08/part-one.zig
blob: 9f879e89388c9fa25358db560ca4998f6926451e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const print = std.debug.print;
const std = @import("std");
const tokenize = std.mem.tokenize;

pub fn main() void {
    var count: usize = 0;
    defer print("{}\n", .{ count });

    var input = tokenize(@embedFile("input"), "\n");
    while (input.next()) |line| {
        var output = tokenize(line[61..], " ");
        while (output.next()) |digit|
            switch (digit.len) {
                2, 3, 4, 7 => count += 1,
                else => {},
            };
    }
}