about summary refs log tree commit diff
path: root/aoc/2021/08/part-one.zig
diff options
context:
space:
mode:
Diffstat (limited to 'aoc/2021/08/part-one.zig')
-rw-r--r--aoc/2021/08/part-one.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/aoc/2021/08/part-one.zig b/aoc/2021/08/part-one.zig
new file mode 100644
index 0000000..0a9ad93
--- /dev/null
+++ b/aoc/2021/08/part-one.zig
@@ -0,0 +1,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 => {},
+            };
+    }
+}