
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
while ((line = await readline())) {
const str = line.trim();
const map = new Map();
for (let i = 0; i < str.length; i++) {
const ch = str[i];
map.set(ch, map.has(ch) ? map.get(ch) + 1 : 1);
}
let minFreq = Infinity;
for (const freq of map.values()) {
minFreq = Math.min(minFreq, freq);
}
let res = "";
for (let i = 0; i < str.length; i++) {
const ch = str[i];
if (map.get(ch) !== minFreq) {
res += ch;
}
}
console.log(res);
}
})();
删除字符串中出现次数最少的字符_牛客题霸_牛客网 (nowcoder.com)