Something went wrong. Try again.
Code for the Advent of Code event
aoc advent-of-code
Something went wrong. Try again.
359 B · 21 lines
Lua
at main
12345678910111213141516171819202122local input = io.open("input.txt", "r")
local floor = 0
local char
local position = 0
repeat char = input:read(1) position = position + 1 if char == "(" then floor = floor + 1 elseif char == ")" then floor = floor - 1 enduntil not char or floor == -1
print("Reached floor -1 at position " .. position)
input:close()