#import "Basic";
#import "String";

solve_day6 :: (test: bool) {
    contents := read_entire_file(ifx test then "inputs/day6_test.txt" else "inputs/day6.txt");    

    part1 := 0;
    part2 := 0;

    t1 := 4;
    t2 := 14;

    for outer: 0..contents.count - t1 {
        for 1..t1 - 1 {
            sli := slice(contents, outer + it, t1 - it);
            if find_index_from_left(sli, contents[outer + it -1]) != -1  continue outer;
        }

        print("Part 1: %\n", outer + t1);
        break;
    }
    for outer: 0..contents.count - t2 {
        for 1..t2 - 1 {
            sli := slice(contents, outer + it, t2 - it);
            if find_index_from_left(sli, contents[outer + it -1]) != -1  continue outer;
        }

        print("Part 2: %\n", outer + t2);
        break;
    }
}