@@ 1,24 1,13 @@
-const std = @import("std");
-const input = @embedFile("input");
-const mem = std.mem;
-const print = std.debug.print;
+const std = @import("std"); const input = @embedFile("input");
-pub fn main() !void {
+pub fn main() !void { var max: usize = 0;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const a = &gpa.allocator;
- var strings = mem.split(input, "\n");
+ var strings = std.mem.split(input, "\n");
var ids = std.AutoHashMap(usize, bool).init(a);
- var max: usize = 0;
- while (strings.next()) |item| {
- var id: usize = 0;
- for (item) |c| {
- id <<= 1;
- id += @boolToInt(c == 'B' or c == 'R');
- }
+ while (strings.next()) |item| { var id: usize = 0;
+ for (item) |c| id = (id << 1) + @boolToInt(c == 'B' or c == 'R');
ids.put(id, true) catch unreachable;
- if (id > max) max = id;
- }
- var i = max;
- while (i > 0) : (i -= 1) _ = ids.get(i) orelse break;
- print("part 1: {}\npart 2: {}\n", .{max, i});
-}
+ if (id > max) max = id; }
+ var i = max; while (i > 0) : (i -= 1) _ = ids.get(i) orelse break;
+ std.debug.print("part 1: {}\npart 2: {}\n", .{max, i}); }<
\ No newline at end of file