Amazon Interview Question

given a dictionary and a character string, try to write a function segmenting the character string into a sequence of words listed in the dictionary