-7 porting Kevin Cruijssen's approach in their 05AB1E answer (as proposed in the "Could probably be..." note above my original answer, below). Also -4 more golfing this.
JŒPṬoḲix@ʋƇo¬ao⁶
A monadic Link that accepts a list of characters and yields a list of characters.
Try it online! (although it's too slow for the longer test cases).
How?
JŒPṬoḲix@ʋƇo¬Ṫao⁶ - Link: Plaintext
J - indices of {Plaintext} -> AllIndices
ŒP - powerset of {AllIndices} (shortest to longest)
Ṭ - untruth -> AllMasks (each with ones at the chosen indices and
zeros elsewhere up to the last chosen index)
Ƈ - keep those of {AllMasks} for which:
ʋ - last four links as a dyad - f(Mask, Plaintext):
o - {Mask} logical OR {Plaintext} (vectorises)
-> Masked (Plaintext with ones in place of chosen indices)
Ḳ - split {Masked} at space characters -> WordsOfMasked
x@ - {Plaintext} repeat {Mask} (vectorises)
-> Substring (i.e. the characters at the chosen indices)
i - first 1-indexed index of {Substring} in {WordsOfMasked}
...or 0 if not found
-> ValidMasks (ordered from fewest to most set bits)
¬ - {Plaintext} logical NOT -> Zeros = [0,0,...,0] (Plaintext's length)
o - {ValidMasks} logical OR {Zeros} (vectorises)
(right pads each mask with zeros to the length of Plaintext)
Ṫ - tail -> ValidMaskWithMaximalSetBits
a - {ValidMaskWithMaximalSetBits} logical AND {Plaintext} (vectorises)
-> X = Plaintext with zeros where we want spaces
o⁶ - {X} logical OR with a space character (vectorises)
(replaces the zeros with spaces)
Original, 28 bytes
-1 inspired by Niel's comment about the original having two helper Links :)
Could probably be slightly terser by using a more bute-force approach (think partitions or powersets) - EDIT: yep, see above.
⁶µḲ¬i¦KẹⱮŒpʋⱮ`ẎQṢ$ƑƇLÞṪḟ@Jµ¦
A monadic Link that accepts a list of characters and yields a list of characters.
Try it online!
How?
⁶µ...µ¦ - Link: Plaintext e.g: "a word is missing mate"
¦ - sparse application to {Plaintext}...
µ µ - ...to indices: monadic chain - f(Plaintext) -> SpaceIndices
⁶ - ...apply: space character -> " i s "
Ḳ¬i¦KẹⱮŒpʋⱮ` - start of the monadic chain: Plaintext
Ḳ - split {Plaintext} at space characters -> PlaintextAsWords
Ɱ` - map across TrialWord in {PlaintextAsWords} with:
ʋ - last four links as a dyad - f(PlaintextAsWords, TrialWord}
e.g. f(["a","word","is","missing","mate"], "is")
¦ - sparse application to {PlaintextAsWords}...
i - ...at indices: first index of {TrialWord} in {PlaintextAsWords}
¬ - ...apply: logical NOT (vectorises)
K - join with space characters -> RedactedPlaintext, e.g:
['a',' ','w','o','r','d',' ',0,0,' ','m','i','s','s','i','n','g',' ','m','a','t','e']
Ɱ - map across Character in {TrialWord} with:
ẹ - indices of {Character} in {RedactedPlaintext}
[[12,15],[13,14]]
Œp - Caterisan product -> AllIndexPicksMakingTrialWord
[[12,13],[12,14],[15,13],[15,14]]
-> AllIndexPicksMakingTrialWordForEachWord
[[[20]],[],[[12,13],[12,14],[15,13],[15,14]],[],[]]
ẎQṢ$ƑƇLÞṪḟ@J - the rest of the monadic chain: AllIndexPicksMakingTrialWordForEachWord
Ẏ - tighten
[[20],[12,13],[12,14],[15,13],[15,14]]
Ƈ - keep those for which:
Ƒ - is invariant under?:
$ - last two links as a monad:
Q - deduplicate
Ṣ - sort
[[20],[12,13],[12,14]
LÞ - sort by length (to place the longest ones on the right)
Ṫ - tail -> KeepCharactersAt
[12,14]
J - indices {Plaintext} -> AllIndices
ḟ@ - {AllIndices} filter discard {KeepCharactersAt}
-> SpaceIndices
[1,2,3,4,5,6,7,8,9,10,11,13,15,16,17,18,19,20,21,22]
" one"a valid solution for"one to one"? \$\endgroup\$wawe awesome somea vlaid input? And what would the expected output be? \$\endgroup\$stressed desserts seeddeealso covers it, seeing as bothstressedanddessertsare longer thanseeddee.wawe awesome someworks and the result isawe some(with a leading space, ideally) \$\endgroup\$