lake i (x:xs) (y:ys) zss      | y == "#"                     = lake i (xs ++ [0]) ys zss
                              | ll > 0 && rl > 0 && ll /= rl = (-1) + lake i (lak rl ll xs ++ [ll]) ys zss
                              | ll > 0                       = lake i (xs ++ [ll]) ys zss
                              | rl > 0                       = lake i (xs ++ [rl]) ys zss
                              | otherwise                    = 1 + lake (succ i) (xs ++ [i]) ys zss
                              where ll = (.|.) x ((.|.) (head xs) (last xs))
                                    rl = xs!!1
lake i (x:xs) (y:ys) zss      | y == "#"                     = lake i (xs ++ [0]) ys zss
                              | ll > 0 && rl > 0 && ll /= rl = (-1) + lake i (lak rl ll xs ++ [ll]) ys zss
                              | ll > 0                       = lake i (xs ++ [ll]) ys zss
                              | rl > 0                       = lake i (xs ++ [rl]) ys zss
                              | otherwise                    = 1 + lake (succ i) (xs ++ [i]) ys zss
                              where ll = (.|.) x ((.|.) (head xs) (last xs))
                                    rl = xs!!1
lake i (x:xs) (y:ys) zss      | y == "#"                     = lake i (xs ++ [0]) ys zss
                              | ll > 0 && rl > 0 && ll /= rl = (-1) + lake i (lak rl ll xs ++ [ll]) ys zss
                              | ll > 0                       = lake i (xs ++ [ll]) ys zss
                              | rl > 0                       = lake i (xs ++ [rl]) ys zss
                              | otherwise                    = 1 + lake (succ i) (xs ++ [i]) ys zss
                              where ll = (.|.) x ((.|.) (head xs) (last xs))
                                    rl = xs!!1