改成这样:
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);
}
})();