Easy two line solution python


#1

An easy solution using split and list reversal.

Source Code

class Solution:
# @param A : string
# @return a strings
def solve(self, A):
# print(A)
B = A.split()
# print (B[::-1])

    return " ".join(B[::-1])
    # return ''.join(C," ")