Pergunta de entrevista da empresa Microsoft

Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words.