LabVIEW, 166 LabVIEW PrimitivesLabVIEW Primitives
First of all i did not create 2 seperate programms because Labview does dataflow so theres really no need.
Saves the histogramm with first element = ascii code of first letter rest from 1-26 go by amount. Lenght simply gets saved in an array.
The first word has 3 checks, first letter, lenght and available letters in histogram. The first letter check stops after the first word.
I check the histogram by decrementing it for every letter and checking if it would fall below 0.
If i found my Nth word and there are no words that are buildable from the left over letters i will start deleting words from the dictonary and redo the Nth word and so on until i have found a solution.
This might or might not work for sentences there are, since that would take forever to compute (my example took a few seconds already).
What i tried
In: Zulus win.
Out: Zulus win.
In: Dovecot flagships oleander.
Out: Dolphin advocates forelegs.
In: Abash abel mammal test.
Out: Amass abbe hamlet malt.