题解 | #括号匹配深度#
括号匹配深度
https://www.nowcoder.com/practice/a2d5b1875bb0408384278f40d1f236c9
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void async function () {
// Write your code here
while(line = await readline()){
var res = 0;
var max = 0;
for(let i=0;i<line.length;i++){
if(line[i] == '('){
res++;
max = res > max ? res : max
}else{
res--;
}
}
console.log(max)
}
}()