/**
* @param {string} s
* @return {number}
*/
var maxDepth = function(s) {
let maxCount = 0;
let openCount = 0;
for (let i = 0; i < s.length; i++) {
if (s[i] === "(") maxCount = Math.max(maxCount, ++openCount);
else if (s[i] === ")") openCount--;
}
return maxCount;
};