Approach hintTry it first, then revealHide
Merge words left to right. Only the last |w| characters of the current result can overlap the next word w, so run the prefix function on w + '#' + tail (or compare hashes) to keep the total work linear.