Solution for problem [Reverse Words in a String]