for (let len = maxlen; len > 0; len--) {
for (let start = 0; start <= maxlen - len; start++) {
let substr = shortest.slice(start, len);
if (strings.every(elem => elem.includes(substr)))
return substr;
}
}