Pregunta de entrevista de Intel Corporation

Reverse sentence problem from leetcode