1. 题目
2. 思路
3. 代码
let s = "leEeetcode"
function makeGood(s) {
if (s.length <= 1) return s
let arr = s.split('')
let res = [arr[0]]
let j = 0
for (let i = 1; i < s.length; i++) {
if (res[j] && res[j] !== arr[i] && res[j].toUpperCase() === arr[i].toUpperCase()) {
res.pop()
j--
} else {
res.push(arr[i])
j++
}
}
return res.join('')
}
console.log(makeGood(s));