const alls = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm' ]; const inputs = inputStr.split(""); const removedDuplicates = Array.from(new Set(inputs)); if (removedDuplicates.length === 13) { console.log(alls.join("\n")) } else if (removedDuplicates.length === 12) { for (let c of alls) { if (!(c in removedDuplicates)) { console.log(c) return; } } } else { console.log("Impossible") }