open(FILE, "<", "../data/2015/1/input.txt") or die $!;

my $read, $steps, $floor = 0;
while (read FILE, $char, 1) {
    $floor += 1 if $char eq "(";
    $floor -= 1 if $char eq ")";
}
print "Part 1: $floor\n";

seek FILE, 0, 0;
$floor = $steps = 0;
while (read FILE, $char, 1) {
    $floor += 1 if $char eq "(";
    $floor -= 1 if $char eq ")";
    $steps++;
    last if $floor < 0;
}

print "Part 2: $steps\n";