In this challenge, your input is a string of lower-case letters like this:
and a dictionary like the that from my other challenge. You may assume that the dictionary file contains only lower-case letters and line-feed characters. Furthermore, the last character in the dictionary file is a line-feed character and the entries are sorted alphabetically.
Write a function that given these two strings, returns a single string containing all possible ways to insert spaces between some of the characters in the input string, such that the words created are all in the dictionary. Each possibility shall be terminated with a line-feed character. Some lines of the output for the example are:
insert spaces between words insert space s between words insert spaces between word s insert space s between word s insert spaces be tween words
The order of the output lines doesn't matter.
This is codegolf, the usual scoring rules apply, standard loopholes are verboten.