2 lines solution in python


#1
    li = A.split()
    return ' '.join(li[::-1])