#include int main() { FILE* input = fopen("../data/2015/1/input.txt", "r"); char c; int floor = 0; while (fread(&c, 1, 1, input) > 0) { if (c == '(') floor++; else if(c == ')') floor--; } printf("Part 1: %d\n", floor); floor = 0; int steps = 0; rewind(input); while (fread(&c, 1, 1, input) > 0) { if (c == '(') floor++; else if(c == ')') floor--; steps++; if (floor < 0) break; } printf("Part 2: %d\n", steps); }