Reverse Words in a String

Take an input string, reverse the string word by word.

Note:=>
A word is defined as a sequence of non-space characters.
The input string may contain leading or trailing spaces. However, your reversed string should not contain leading or trailing spaces.
Try to solve this in linear time.
the sky is blue
Total : 0 Discussion
Login