const std = @import("std"); const mem = std.mem; const fmt = std.fmt; const input = @embedFile("input"); pub fn main() !void { input: for (input) |_, i| { // Start searching at fourth character if (i < 3) continue; if (i > input.len - 3) break; const chars: []const u8 = input[i-3..i+1]; std.debug.print("{s}\n", .{chars}); chars: for (chars) |char_1, j| { for (chars) |char_2, k| { // Don't check the same character, or the ones that we already checked if (j <= k) continue; //std.debug.print("{c},{c}\n", .{char_1, char_2}); if (char_1 == char_2) { // Don't check anymore break :chars; } } } else { // If no repeats have been found // i is the current character index in the input (i+1 if we count from 1) std.debug.print("Solution found: {}\n", .{i+1}); break :input; } } }