Mothers arranged a dance party for the children in school. At that party, there are only mothers and their children. All are having great fun on the dance floor when suddenly all the lights went out. It's a dark night and no one can see each other. But you were flying nearby and you can see in the dark and have ability to teleport people anywhere you want.

Legend:
-Uppercase letters stands for mothers, lowercase stand for their children, i.e. "A" mother's children are "aaaa".
-Function input: String contains only letters, uppercase letters are unique.
Task:
Place all people in alphabetical order where Mothers are followed by their children, i.e. "aAbaBb" => "AaaBbb".

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def find_children(dancing_brigade):
	

Solutions:
def find_children(dancing_brigade):
	return ''.join(sorted(dancing_brigade, key=lambda c: (c.upper(), c.islower())))


def find_children(s):
	return ''.join(sorted(sorted(s), key=str.lower))


def find_children(people):
	string = []
	answer = []
	symbol = ''
	index = -1
	dex = -1
	alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
	for lol in people:
		string.append(lol)
	symbol = ''
	index = -1
	dex = -1
	for nim in range(len(string)):
		dex = -1
		index += 1
		symbol = string[index]
		for num in range(len(alphabet)):
			dex += 1
			if alphabet[dex].find(symbol) != -1:
				break
		if dex <= 25:
			string[nim] = alphabet[dex + 26] + string[nim]
		else:
			string[nim] = string[nim] + string[nim]
	symbol = ''
	index = -1
	dex = -1
	string.sort()
	string = string + ['!!']
	for nam in range(len(string)):
		string[nam] = string[nam][1:]
	while symbol != '!':
		dex = -1
		index += 1
		symbol = string[index]
		if symbol == '?' or symbol == '!':
			continue
		for num in range(len(alphabet)):
			dex += 1
			if alphabet[dex].find(symbol) != -1:
				break
		if dex <= 25:
			for num in range(string.count(symbol)):
				answer.append(symbol)
			string = ' '.join([str(i) for i in string]).replace(alphabet[dex], '?').split(' ')
		else:
			answer.append(alphabet[dex])
	return ''.join([str(i) for i in answer])
print(find_children('aabAB'))


def find_children(s):
	return ''.join(sorted(s, key=lambda c: (c.lower(), c)))


def find_children(dancing_brigade):
	return ''.join(sorted(dancing_brigade, key=lambda c: (c.lower(), c.islower())))


def find_children(dancing_brigade):
	return ''.join(sorted(dancing_brigade, key=lambda l: (l.lower(), l)))


def find_children(db):
	return ''.join(sorted(db, key=lambda a: (a.upper(), a)))


def find_children(dancing_brigade):
	a = sorted(dancing_brigade)
	b = ''
	for i in range(len(a)):
		b += a[i]
		for j in range(i + 1, len(a)):
			if a[i].lower() == a[j].lower():
				b += a[j]
	return b[:len(a)]


def find_children(dancing_brigade):
	c = ''
	L = sorted(dancing_brigade.lower())
	for i in range(len(L)):
		if L[i] != c:
			L[i] = L[i].upper()
			c = L[i].lower()
	return ''.join(L)


def find_children(a):
	return ''.join(sorted(a, key=lambda s: (s.upper(), s.islower())))