Ordering words to fit in a given string Given a string of letters and a set of words, output an ordering of the words so
that they can be found in the string by dropping letters that are not needed.
Words may occur more than once in the word set. The input string and all words
will consist of 1 to 1000 lower case letters each. The letters to be dropped may occur inside words or between words.

Your program or function can accept the letter string and words as lists, a string, or from STDIN, and must output all words in a correct order as a list
or string output. If there is more than one correct solution, only output one of
them. If there is no possible correct solution, output an empty list or an empty
string.

Examples:

dogcatfrog cat frog dog
-&gt; dog cat frog

xxcatfixsxhingonxgrapexxxfishingcxat cat grape catfish fishing
-&gt; catfish grape fishing cat

dababbabadbaccbcbaaacdacdbdd aa bb cc dd ba ba ba ab ac da db dc
-&gt; da ab ba ba ba cc bb aa ac dc db dd

flea antelope
-&gt;
(no solution)


This is code golf. Lowest number of bytes wins.

Edit: Explained that extra characters can be inside words.
Pyth, 20 24 bytes
My first attempt on Pyth :)
Jcw;FG.ptJI:hJj&quot;.*&quot;G0jdG

How it works:
Jcw;FG.ptJI:hJj&quot;.*&quot;G0jdG
Jcw                         assign(&quot;J&quot;,chop(input()))
    FG.ptJ                  for G in permutations(tail(J)):
          I:hJj&quot;.*&quot;G0        if match(head(J),join(&quot;.*&quot;,G)):
                     jdG      print(join(&quot; &quot;,G))

Notes: it takes a long time in the third example (dababbabadbaccbcbaaacdacdbdd aa bb cc dd ba ba ba ab ac da db dc).