Given an array of characters which forms a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
Example input and
Push each word onto a stack. Pop all the words off the stack.