Histogram Problem

I am getting run-error while submitting. Please help

ur error -> first ask if stack is empty then check a[s.tOP() ] > A[i])

still the answer is wrong

refer to the code below


added comments