Pregunta de entrevista de Microsoft

Given a dictionary and a function that returns if a work is in the dictionary, create a function that takes a non-space delimited string and outputs the same string with words separated by spaces.