Index: aoc2024.c ================================================================== --- aoc2024.c +++ aoc2024.c @@ -18,16 +18,23 @@ err += 1; // skip '|' pagepair[npp][1] = strtoul(line, &err, 10); npp++; line = strtok(NULL, "\n"); } - printf("first pagepair: %u and %u\n", pagepair[0][0], pagepair[0][1]); - printf("last pagepair: %u and %u\n", pagepair[npp - 1][0], pagepair[npp - 1][1]); - printf("got %u pairs\n", npp); + printf("%u\n", pagepair[0][0]); + unsigned update[512], nupdates, maxupdates = 0; while ((line = strtok(NULL, "\n")) != NULL) { - // process line + nupdates = 0; + char *err = line; + for (;;) { + update[nupdates++] = strtoul(err, &err, 10); + if (*err == ',') err++; + else break; + } + if (nupdates > maxupdates) maxupdates = nupdates; } + printf("%u nax updates\n", maxupdates); } static size_t rcmap(unsigned size, unsigned row, unsigned col) { return row * (size + 1) + col; }