{
const incompleteLines = lines
.map((l) => isLineValid(l))
.filter((result) => result[0]);
let score = 0;
const points = {
"(": 1,
"[": 2,
"{": 3,
"<": 4
};
const scores = incompleteLines.map(([, stack]) =>
stack.reverse().reduce((acc, val) => acc * 5 + points[val], 0)
);
return scores.sort((a, b) => a - b)[Math.floor(scores.length / 2)];
}