题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
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 strObj = {} let str = "" while(line = await readline()){ for (const s of line) { if (strObj[s]) { strObj[s] += 1 } else { strObj[s] = 1 } } const minCount = Math.min(...Object.values(strObj)) for (let i = 0;i < line.length; i++) { const curr = line[i] if (strObj[curr] !== minCount) { str += curr } } console.log(str); } }()