Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result.

Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).

If the input string is empty, return an empty string.
The words in the input String will only contain valid consecutive numbers.


## Examples

```
"is2 Thi1s T4est 3a"  -->  "Thi1s is2 3a T4est"
"4of Fo1r pe6ople g3ood th5e the2"  -->  "Fo1r the2 g3ood 4of th5e pe6ople"
""  -->  ""
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def order(sentence):
	

Solutions:
def order(sentence):
	return ' '.join(sorted(sentence.split(), key=lambda x: int(''.join(filter(str.isdigit, x)))))


def order(words):
	return ' '.join(sorted(words.split(), key=lambda w: sorted(w)))


def order(sentence):
	if not sentence:
		return ''
	result = []
	split_up = sentence.split()
	for i in range(1, 10):
		for item in split_up:
			if str(i) in item:
				result.append(item)
	return ' '.join(result)


def extract_number(word):
	for l in word:
		if l.isdigit():
			return int(l)
	return None

def order(sentence):
	return ' '.join(sorted(sentence.split(), key=extract_number))


def order(s):
	z = []
	for i in range(1, 10):
		for j in list(s.split()):
			if str(i) in j:
				z.append(j)
	return ' '.join(z)


import re

class Word(object):
	digit_regex = re.compile('[0-9]')

	def __init__(self, word):
		self._index = self.digit_regex.findall(word)[0]
		self._word = word

	def __repr__(self):
		return self._word

	@property
	def word(self):
		return self._word

	@property
	def index(self):
		return self._index

class Sentence(object):

	def __init__(self, words):
		self._words = words

	def __repr__(self):
		return ' '.join([str(x) for x in self.ordered()])

	def ordered(self):
		return sorted(self._words, key=lambda word: word.index)

def order(sentence):
	return str(Sentence(list(map(Word, sentence.split()))))


order = lambda xs: ' '.join(sorted(xs.split(), key=min))


def order(sentence):

	def sort_key(s):
		return next((c for c in s if c.isdigit()))
	return ' '.join(sorted(sentence.split(), key=sort_key))


def order(sentence):
	data = sentence.split()
	result = []
	for word in data:
		for letter in word:
			if letter.isdigit():
				result.append([int(letter), word])
	return ' '.join([x[1] for x in sorted(result)])


import re

def order(sentence):
	string_final = ''
	if sentence == '':
		return sentence
	lista = sentence.split()
	posicao = 1
	while posicao <= len(lista):
		for i in range(len(lista)):
			if re.findall('\\d+', lista[i]) == [str(posicao)]:
				string_final = string_final + lista[i] + ' '
				break
		posicao += 1
	return string_final[:-1]