Amazon interview question

Sentence rearrangement