Using Strip and split and reversed in python


#1

class Solution:
# @param A : string
# @return a strings
def solve(self, A):
word = A.strip().split()
reverse = " ".join(reversed(word))
return str(reverse)