改成这样: 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 const str = await readline(); const inarr = str.split(""); const arr = []; for (let i = 0, l = inarr.length; i < l; i++) { const item = inarr[i]; if (i > 0 &;&; item === arr[arr.length - 1]) { arr.pop(); } else { arr.push(item); } } if (arr.length > 0) { console.log(arr.join("")); } else { console.log(0); } })();
1 1

相关推荐

吴offer选手:下午mt一来就告警说项目来不及,估计明天拿了权限就要参与开发了 已老实
实习生的蛐蛐区
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务