function generateDocument(characters, document) {
const frequency = {};
for (const c of characters) {
if (frequency[c] === undefined) frequency[c] = 0;
frequency[c] += 1;
}
console.log({
frequency
});
for (const c of document) {
if (frequency[c] === undefined || frequency[c] === 0) return false;
frequency[c] -= 1;
}
return true;
}
// Do not edit the line below.
exports.generateDocument = generateDocument;