VISUALGO//PROBLEMS
reverse words in a string · array / stringmedium
words
the
sky
is
blue
reversed
···
···
···
···
ELEMENTS
s
Python
def reverseWords(s: str) -> str:
words = s.split()
return ' '.join(words[::-1])def reverseWords(s: str) -> str:
words = s.split()
return ' '.join(words[::-1])