coordvalue(s, onechar) = reduce((x, c) -> (x << 1) ⊻ (c == onechar), s; init=0)

seatid(s) = 8coordvalue(s[1:7], 'B') + coordvalue(s[8:10], 'R')

part1(seats) = maximum(seats)

part2(seats) = seats[findfirst((seats[2:end] - seats[1:end-1]) .== 2)] + 1

let seats = sort!(map(seatid, readlines("input.txt")))
    @info "Solutions" part1(seats) part2(seats)
end
