Python Saved Program: gifted-mountain

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


def depth(s):
    m=0
    cm=0
    n=len(s)
    i=0
    while(i<n):
        if(s[i]=='('):
            cm=cm+1
        elif(s[i]==')'):
            if(m<cm):
                m=cm
            cm=0
        i=i+1
    return m
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs