Find acronym-like words in a sentence Let's say you have a sentence like:

this is a very long sentence with several words of no significance


It contains only the 26 lowercase letters of the alphabet and spaces.

And you have a dictionary, where each word contains any number of the 26 lowercase letters and nothing else:

henge
renton


Then the output should contain, among others:


tHis is a vEry long seNtence with several words of no siGnificancE
tHis is a vEry long senteNce with several words of no siGnificancE  
this is a veRy long sENTence with several wOrds of no significaNce


So, every line of the output is the original sentence, but if only the uppercase letters of a line are taken, they should form a dictionary word. The program should find all possible such lines.
JavaScript, 474 bytes
k=((e,r)=&gt;{for(o=[],e=[...e],r=[...r],w=r.reduce((r,h,n)=&gt;!(r[n]=e.map((e,r)=&gt;h==e?r:&quot;&quot;).filter(Number))||r,[]),[z]=w,h=[],x=0;x&lt;w.reduce((e,r)=&gt;e*=r.length||e,1);x++)z.forEach((e,r)=&gt;{for(g=[z[r]],j=1;j&lt;w.length;j++)for(n=w[j],y=0;y&lt;n.length;y++)if(g.slice(-1)[0]&lt;n[y]&amp;&amp;!h.some(e=&gt;e.toString()==[...g,n[y]].toString())){g.push(n[y]);break}h.push(g)});return h.filter(e=&gt;e.length==w.length).forEach(r=&gt;{d=[...e],r.forEach(e=&gt;d[e]=d[e].toUpperCase()),o.push(d.join(&quot;&quot;))}),o})

Live example:


k=((e,r)=&gt;{for(o=[],e=[...e],r=[...r],w=r.reduce((r,h,n)=&gt;!(r[n]=e.map((e,r)=&gt;h==e?r:"").filter(Number))||r,[]),[z]=w,h=[],x=0;x&lt;w.reduce((e,r)=&gt;e*=r.length||e,1);x++)z.forEach((e,r)=&gt;{for(g=[z[r]],j=1;j&lt;w.length;j++)for(n=w[j],y=0;y&lt;n.length;y++)if(g.slice(-1)[0]&lt;n[y]&amp;&amp;!h.some(e=&gt;e.toString()==[...g,n[y]].toString())){g.push(n[y]);break}h.push(g)});return h.filter(e=&gt;e.length==w.length).forEach(r=&gt;{d=[...e],r.forEach(e=&gt;d[e]=d[e].toUpperCase()),o.push(d.join(""))}),o})

console.log(k('this is a very long sentence with several words of no significance', 'henge'));



Explanation:
For each letter in the word, an array of indices is constructed corresponding to every position of that letter in the sentence.
Then inside a nest of 4 for loops, every possible path from the first array to the last array is computed, where each step is into an element with greater numeric value in the next array.
This produces an array of paths whose length is equal to the maximum possible paths, which is the product of multiplying the length of each letter indices array (this number gets big real quick as the length of the word increases).
Then all paths whose length is smaller than the word are excluded, since they failed to find a valid step between each array.
You can see the unminified logic at this stackoverflow answer.
I am confused by this line (even though it's my code), whose intent is to check the existing paths before adding a step to the current path to make sure its constructing a unique path:
if (!paths.some(p =&gt; p.toString() == [...path, arrays[j][y]].toString())) {
  path.push(arrays[j][y]);
  break;
}

It seems to me like this should erroneously prevent construction of multiple paths who share any beginning steps.  But it actually works as intended.  So I am stumped.