reverse words in python hackerrank solution