Reverse Words in a String III

Problem Id: 557 Difficulty: Easy


Intuition

Solution


class Solution:
    def reverseWords(self, s: str) -> str:
        words = s.split(' ')
        words = [w[::-1] for w in words]
        return ' '.join(words)