Company: Ibm_25oct
Difficulty: medium
Lost Fragments A message-sending service has broken down, and parts of messages are being lost on the way. A message is a string of words separated by single spaces. You are given the message that was sent and the message that was received . Every word of received occurs in sent in the same order, though not necessarily next to each other -- received is what remains of sent after some of its words were dropped. Find the words of sent that did not arrive, and return them in the order in which they appear in sent . When a word occurs several times, match the words of received to sent from left to right: each word of received is matched to the earliest not-yet-used occurrence in sent that comes after the previous match. Every word of sent that is not matched this way is lost. (inferred -- the source does not say which occurrence of a repeated word was lost; its samples are consistent with leftmost matching, the standard reading) Complete the function lostFragments(sent, received) , which