function part2(input) {
let seqPrices = new Map();
input.split("\n").forEach((secret) => {
const changes = changeSequence(Number(secret), 2000);
const monkeySeq = new Map();
let seq4 = changes.slice(0, 4).map((d) => d[1]);
monkeySeq.set(encodeSeq(seq4), changes[3][0]);
for (let i = 4; i < changes.length; i++) {
seq4.push(changes[i][1]);
seq4.shift();
const seqKey = encodeSeq(seq4);
if (!monkeySeq.has(seqKey)) {
monkeySeq.set(seqKey, changes[i][0]);
}
}
seqPrices = AOC.mergeMaps(seqPrices, monkeySeq);
});
return d3.max([...seqPrices.values()]);
}