Here is the code, I’ve written.

```
def max_depth(brac):
m, mi = 0, 0
i, l = 0, 0
for i in range(len(brac)):
if brac[i] == '1': l += 1
else:
if l > m:
m = l
mi = i
l = 0
return f'{m} {mi}'
def max_lenth(brac):
c, m, ml, p, pl = 0, 0, 0, 0, 0
for i, x in enumerate(brac):
if x == '1':
c += 1
ml += 1
else:
c -= 1
ml += 1
if c == 0:
if ml > m:
m = ml
p = i-ml
ml = 0
return f'{m} {p+2}'
_, brac = input(), input().split()
print(f'{max_depth(brac)} {max_lenth(brac)}')
```

Someone can please point out what Am I doing wrong?