求大佬们教js这道题目怎么复制答案
全部评论
改成这样:
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);
}
})();
蹲个答案,学习一下
相关推荐
查看10道真题和解析 点赞 评论 收藏
分享
李橙子:你这如果想找java方向的,那你的项目就不要写python啊,不然会以为你是主要找python的 点赞 评论 收藏
分享

华为HUAWEI公司氛围 740人发布