Maximum nesting depth of the parentheses

leetcode

class Solution:
    def maxDepth(self, s: str) -> int:
        count = 0
        ret = 0
        for b in s: 
            if b == "(":
                count += 1
                ret = max(count,ret)
            if b ==")": 
                count -=1 
        return ret