function arrangements(tSet, design, mxLen) {
const counts = Array(design.length + 1).fill(0);
counts[0] = 1;
for (let j = 1; j <= design.length; j++) {
for (let i = Math.max(0, j - mxLen); i < j; i++) {
if (tSet.has(design.slice(i, j))) {
counts[j] += counts[i];
}
}
}
return counts.at(-1);
}