//1.遍历字符串如果是左括号就+1 如果是右括号就-1 //2.在遇到左括号时就执行1*2*3...。 const readline = require("readline") const rl = readline.createInterface({ input: process.stdin, output: process.stdout }) rl.on("line", function (n) { let index = 1 let res = 1 n.split("").forEach((item) => { if (item === "(") { res *= index index++ } else { index-- } }) console.log(res) }) function gcd(x, y) { return x % y === 0 ? y : gcd(y, x % y) } rl.on("close", function () { process.exit() })