Complete the solution so that it reverses all of the words within the string passed in. 

Example:

```python
reverseWords("The greatest victory is that which requires no battle")
// should return "battle no requires which that is victory greatest The"
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Starter code: def reverseWords(s):
	

Solutions:
def reverseWords(str):
	return ' '.join(str.split(' ')[::-1])


def reverseWords(str):
	return ' '.join(reversed(str.split(' ')))


def reverseWords(string):
	return ' '.join(reversed(string.split()))


def reverseWords(str):
	k = str.split(' ')
	k.reverse()
	str = ' '.join(k)
	return str


def reverseWords(string):
	return ' '.join(string.split()[::-1])


def reverseWords(str):
	str_list = str.split(' ')
	rev_list = str_list[::-1]
	rev_str = ' '.join(rev_list)
	return rev_str


def reverseWords(str):
	str_split = str.split()
	rev_words = []
	for i in range(len(str_split) - 1, -1, -1):
		rev_words.append(str_split[i])
	return ' '.join(rev_words)


def reverseWords(str):
	s = str.split(' ')
	string = []
	for e in s:
		string.insert(0, e)
	return ' '.join(string)


def reverseWords(str):
	new_arr = []
	for word in str.split():
		new_arr.append(word)
	new_arr.reverse()
	return ' '.join(new_arr)


reverseWords = lambda s: ' '.join(s.split(' ')[::-1])


reverseWords = lambda s: ' '.join(reversed(s.split(' ')))


def reverseWords(str):
	return ' '.join([i for i in str.split(' ')[::-1]])


import re

def reverseWords(str):
	return ''.join(re.split('(\\s+)', str)[::-1])


def reverseWords(s):
	arr = s.split()
	arr = arr[::-1]
	str = ''
	for el in arr:
		str += el + ' '
	return str[:-1]


def reverseWords(str):
	a = str.split(' ')
	b = ''
	c = a[::-1]
	for i in range(0, len(a)):
		if i != len(a) - 1:
			b += c[i] + ' '
		else:
			b += c[i]
	return b


reverseWords = lambda ss: ' '.join(ss.split(' ')[-1::-1])


def reverseWords(str):
	liststr = str.split()
	liststr.reverse()
	newstr = ''
	for i in range(len(liststr)):
		newstr += liststr[i]
		if i != len(liststr) - 1:
			newstr += ' '
	return newstr


def reverseWords(s):
	return ' '.join(s.split()[::-1])


def reverseWords(s):
	b = s.split()
	b.reverse()
	return ' '.join(b)


def reverseWords(s):
	words = s.split()
	reversed = ''
	index = len(words)
	while index > 0:
		index -= 1
		reversed = reversed + ' ' + words[index]
	return reversed[1:]


def reverseWords(s):
	words = s.split()
	i = ''
	index = len(words)
	while index > 0:
		index -= 1
		i = i + ' ' + words[index]
	return i[1:]


def reverseWords(s):
	print(s)
	words = s.split()
	rev = ''
	i = len(words)
	while i > 0:
		i -= 1
		rev += words[i] + ' '
	print(rev)
	return rev[:-1]


def reverseWords(s):
	a = s.split()
	return ' '.join(reversed(a))


def reverseWords(s):
	t = s.split()
	return ' '.join(reversed(t))


def reverseWords(s):
	result = ''
	orded = s.split(' ')
	i = len(orded)
	while i > 0:
		result += orded[i - 1]
		if i > 1:
			result += ' '
		i -= 1
	return result


def reverseWords(s):
	words = s.split(' ')
	reverse_s = ' '.join(reversed(words))
	return reverse_s


def reverseWords(s):
	output = ''
	inp = s.split(' ')
	for i in inp:
		output = ' ' + i + output
	return output[1:len(output)]


def reverseWords(s):
	word = s.split(' ')
	reverseWords = ' '.join(reversed(word))
	return reverseWords


def reverseWords(s):
	s_list = s.split()
	rev_s_list = s_list[::-1]
	return ' '.join(rev_s_list)


def reverseWords(s):
	s = s.split()
	empty = []
	while len(s) > 0:
		empty.append(s.pop())
	else:
		return ' '.join(empty)


def reverseWords(s):
	reverse = s.split()
	strng = ''
	for i in range(1, len(reverse) + 1):
		strng += reverse[-i] + ' '
	return strng[:-1]


def reverseWords(s):
	s = list(s.split())
	return ' '.join(reversed(s))


def reverseWords(s):
	words = s.split()
	return ' '.join([words[-i - 1] for i in range(len(words))])


def reverseWords(s):
	holder = s.split(' ')
	(i, j) = (0, len(holder) - 1)
	while i < j:
		(holder[i], holder[j]) = (holder[j], holder[i])
		i += 1
		j -= 1
	return ' '.join(holder)


def reverseWords(s):
	x = s.split()
	y = x[::-1]
	return ' '.join(y)


def reverseWords(s):
	array = s.split()
	array.reverse()
	return ' '.join(array)


def reverseWords(s):
	w = s.split(' ')
	output = []
	for word in w:
		output.insert(0, word)
	return ' '.join(output)


def reverseWords(s):
	reverse_s = s.split()
	reverse_s.reverse()
	s = ' '.join(reverse_s)
	return s


def reverseWords(s):
	rev = [i for i in s.split()]
	return ' '.join(rev[::-1])


def reverseWords(s):
	g = s.split(' ')
	g.reverse()
	return ' '.join(g)


def reverseWords(s):
	reversed_str = ''
	s = s.split()
	for word in s:
		reversed_str = word + ' ' + reversed_str
	return reversed_str.strip()


def reverseWords(s):
	return ' '.join((w[::-1] for w in s.split()))[::-1]


def reverseWords(s):
	spl = s.split(' ')
	x = spl[::-1]
	new = ''
	for i in x:
		new += i + ' '
	return new.strip()


def reverseWords(s):
	ls = s.split()
	lsn = ls[::-1]
	return ' '.join(lsn)


def reverseWords(s):
	l = s.split(' ')
	v = []
	for i in l:
		v.insert(0, i)
		v.insert(0, ' ')
	return ''.join(v)[1:]


def reverseWords(s):
	a = ''.join((i + ' ' for i in s.split()[::-1]))
	return a[:-1]


def reverseWords(s):
	s = s.split(' ')
	string = []
	for w in s:
		string.insert(0, w)
	string = ' '.join(string)
	return string[:]


def reverseWords(s):
	x = s.split()
	y = x[::-1]
	z = ' '.join((str(a) for a in y))
	return z


def reverseWords(s):
	word = list(s.split(' '))
	word.reverse()
	return ' '.join(word)


def reverseWords(s):
	str_split = s.split(' ')
	string = ''
	for i in str_split:
		string = i + ' ' + string
	return string.rstrip()


def reverseWords(s):
	for line in s.split('\n'):
		return ' '.join(line.split()[::-1])


def reverseWords(s):
	s = s.split(' ')
	s.reverse()
	x = ' '
	return x.join(s)


def reverseWords(s):
	a = s.split()
	a.reverse()
	b = a[0]
	a.pop(0)
	for x in a:
		b = b + ' ' + x
	return b


def reverseWords(s):
	x = s.split()
	y = x[::-1]
	strin = ''
	for i in y:
		strin += i + ' '
	return strin.rstrip()


def reverseWords(s):
	s = s.split(' ')
	r = ''
	for x in range(0, len(s)):
		r += s[len(s) - x - 1]
		if x != len(s) - 1:
			r += ' '
	return r


def reverseWords(s: ''):
	s = s.split()
	result = ''
	for i in s:
		result = i + ' ' + result
	return result.strip(' ')


def reverseWords(s):
	t = s.split()
	z = t[::-1]
	return ' '.join(z)


def reverseWords(s):
	s = s.split(' ')
	s.reverse()
	res = ' '.join(s)
	return res


def reverseWords(s):
	y = s.split(' ')
	x = ' '.join(reversed(y))
	return x


def reverseWords(s):
	l = []
	l = s.split(' ')
	l.reverse()
	f = ''
	for i in l:
		f += i + ' '
	return f[:len(f) - 1]


def reverseWords(s):
	list_of_s = s.split(' ')
	list_of_s.reverse()
	return ' '.join(list_of_s)


reverseWords = lambda word: ' '.join(word.split(' ')[::-1])


def reverseWords(s):
	string = ''
	s = s.split()
	for word in reversed(range(len(s))):
		string += s[word]
		string += ' '
	string = string[:-1]
	return string


def reverseWords(r):
	s = r.split()
	r = ''
	for i in range(1, len(s) + 1):
		r += s[-i] + ' '
	return r[:-1]


def reverseWords(s):
	a = s.split()
	b = a[::-1]
	return ' '.join(b)


def reverseWords(s):
	x = [x for x in s.split(' ')]
	return ''.join((x + ' ' for x in x[::-1]))[:-1]


def reverseWords(s):
	return ' '.join(reversed([w for w in s.split()]))


def reverseWords(str):
	words = str.split()
	words = list(reversed(words))
	reverse_str = ' '.join(words)
	return reverse_str


def reverseWords(str):
	strings = str.split(' ')
	strings.reverse()
	return ' '.join(strings)


def reverseWords(str):
	arr = str.split(' ')
	arr.reverse()
	return ' '.join(arr).rstrip()


def reverseWords(str):
	arr = list(str.split())
	arr.reverse()
	return ' '.join([i for i in arr])


def reverseWords(str):
	a = str.split()
	b = ' '.join(reversed(a))
	return b


def reverseWords(str):
	final_str = ''
	str_lst = str.split(' ')[::-1]
	for word in str_lst:
		final_str += word
		final_str += ' '
	return final_str.strip()


def reverseWords(str):
	s = str.split(' ')
	ans = ''
	for i in range(len(s) - 1, -1, -1):
		if i != len(s) - 1:
			ans += ' '
		ans += s[i]
	return ans


def reverseWords(str):
	word = str.split(' ')
	reverse = ' '.join(reversed(word))
	return reverse


def reverseWords(words):
	new_words = list(reversed(words.split()))
	return ' '.join(new_words)


def reverseWords(str):
	result = ''
	s1 = str.split(' ')
	print(s1)
	s2 = s1[::-1]
	print(s2)
	result = ' '.join(s2)
	return result


def reverseWords(str):
	rev_list = list(str.split(' '))
	rev_str = ''
	for i in range(len(rev_list) - 1, -1, -1):
		rev_str += rev_list[i]
		if i != 0:
			rev_str += ' '
	return rev_str