Leetcode

151.reverseWordsInAString.py

class Solution:
    def reverseWords(self, s: str) -> str:
        return " ".join([x for x in reversed([y for y in s.split(" ") if y != ""])])