Maximum Depth of Consecutive Parenthesis

this is my code, whenever i check in online IDE, it is giving me correct output but when I’m submitting in hacker block, it is showing me as wrong error. Can some one help me out.