You are given a string $\mbox{S}$. 

$\mbox{S}$ contains alphanumeric characters only. 

Your task is to sort the string $\mbox{S}$ in the following manner:

All sorted lowercase letters are ahead of uppercase letters. 
All sorted uppercase letters are ahead of digits.
All sorted odd digits are ahead of sorted even digits.

Input Format

A single line of input contains the string $\mbox{S}$.

Constraints

$0<len(S)<1000$

Output Format

Output the sorted string $\mbox{S}$.

Sample Input
Sorting1234

Sample Output
ginortS1324

Source: hackerrank | Difficulty: MEDIUM


Solutions:
def value_of_char(char):
	value = 0
	if char.isdigit():
		digit = int(char)
		value = (3, 2 if digit % 2 == 0 else 1)
	if char.islower():
		value = (1,)
	if char.isupper():
		value = (2,)
	return (value, char)
string = input().strip()
list(map(lambda c: print(c, end=''), sorted(string, key=value_of_char)))


def customkey(x):
	if x.islower():
		return ord(x) - ord('a')
	elif x.isupper():
		return 100 + ord(x) - ord('A')
	elif x.isdigit():
		if int(x) % 2 == 1:
			return 200 + int(x)
		else:
			return 300 + int(x)
x = input()
y = sorted(x, key=customkey)
print(*y, sep='')


import string
lower = string.ascii_lowercase
upper = string.ascii_uppercase
odd = string.digits[1::2]
even = string.digits[::2]
S = sorted(input())
list(map(lambda x: print(x, end=''), filter(lambda x: lower.find(x) >= 0, S)))
list(map(lambda x: print(x, end=''), filter(lambda x: upper.find(x) >= 0, S)))
list(map(lambda x: print(x, end=''), filter(lambda x: odd.find(x) >= 0, S)))
list(map(lambda x: print(x, end=''), filter(lambda x: even.find(x) >= 0, S)))


import functools
s = input()
lower_alpha = list(filter(lambda x: x >= 'a' and x <= 'z', s))
lower_alpha.sort()
upper_alpha = list(filter(lambda x: x >= 'A' and x <= 'Z', s))
upper_alpha.sort()
odd_digits = list(filter(lambda x: x >= '0' and x <= '9' and (int(x) % 2 == 1), s))
odd_digits.sort()
even_digits = list(filter(lambda x: x >= '0' and x <= '9' and (int(x) % 2 == 0), s))
even_digits.sort()
result = lower_alpha + upper_alpha + odd_digits + even_digits
print(functools.reduce(lambda a, b: str(a) + str(b), result))


import operator
from functools import reduce
s = input()

def key_function(s):
	if s.isupper():
		return ord(s) + 123
	elif s.islower():
		return ord(s)
	else:
		if int(s) % 2 == 1:
			return int(s) + 1234
		return int(s) + 12345
print(reduce(operator.__add__, sorted(s, key=key_function)))


from functools import reduce
from operator import add
inp = input()
print(reduce(add, sorted(filter(lambda x: x.islower(), inp))) + reduce(add, sorted(filter(lambda x: x.isupper(), inp))) + reduce(add, sorted(filter(lambda x: x.isdigit() and int(x) % 2, inp)), '') + reduce(add, sorted(filter(lambda x: x.isdigit() and int(x) % 2 == 0, inp)), ''))


s = input()
lookup = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1357902468'
print(*sorted(s, key=lambda c: lookup.find(c)), sep='')


def keys(c):
	o = ord(c)
	if o >= 48 and o <= 57:
		i = int(c)
		if i % 2 == 0:
			return o + 300
		else:
			return o + 150
	elif o >= 97 and o <= 122:
		return o - 100
	else:
		return o
print(*sorted(input(), key=keys), sep='', end='\n')


def key_func(c):
	if 'a' <= c <= 'z':
		return ord(c) - 300
	elif 'A' <= c <= 'Z':
		return ord(c) - 200
	elif c in '13579':
		return ord(c) - 100
	else:
		return ord(c)
S = input()
print(*sorted(S, key=key_func), sep='')


import sys
stdin = sys.stdin
s = stdin.readline().strip()
print(str(sorted(s, key=lambda x: ord(x) + 200 - int(x) % 2 * 100 if x <= '9' else ord(x.swapcase()))).replace("'", '').replace('[', '').replace(']', '').replace(', ', ''))


from array import array
this = input()

def getkey(a):
	if a.isdigit() and int(a) % 2 == 1:
		return int(a) + 700
	elif a.isdigit():
		return int(a) + 800
	elif a.islower():
		return ord(a)
	else:
		return ord(a) + 100
a = sorted(this, key=getkey)
c = array('B', map(ord, a)).tostring()
print(c.decode())


from functools import reduce
import operator
print(reduce(operator.add, sorted(input(), key=lambda x: (not x.islower(), not x.isupper, x in '02468', x in '13579', x))))


def __starting_point():
	string = input().strip()
	print(*sorted(string, key=lambda x: (-x.islower(), x.isdigit() - x.isupper(), x in '02468', x)), sep='')
__starting_point()


from functools import reduce
s = lambda c: ord(c) - 200 if c.islower() else ord(c) - 100 if c.isupper() else int(c) + 10 if not int(c) % 2 else int(c)
print(reduce(lambda a, b: a + b, sorted(input(), key=s)))


s = input()

def check(x):
	try:
		if int(x) % 2 == 1:
			return True
		else:
			return False
	except:
		return False
print(str(sorted(s, key=lambda x: (not x.islower(), not x.isupper(), not check(x), x))).replace("'", '').replace(',', '').replace(' ', '').replace('[', '').replace(']', ''))


import operator
import functools

def fto(c):
	if c.islower():
		return ord(c) - ord('a')
	elif c.isupper():
		return 100 + ord(c) - ord('A')
	elif c.isdigit() and int(c) % 2 == 1:
		return 200 + ord(c) - ord('0')
	elif c.isdigit() and int(c) % 2 == 0:
		return 300 + ord(c) - ord('0')
	else:
		return -1

def ffrom(i):
	if i < 100:
		return chr(i + ord('a'))
	elif i < 200:
		return chr(i + ord('A') - 100)
	elif i < 300:
		return chr(i + ord('0') - 200)
	elif i < 400:
		return chr(i + ord('0') - 300)
	else:
		return -1
txt = list(input())
txt = list(map(fto, txt))
txt.sort()
ret = functools.reduce(operator.add, list(map(ffrom, txt)))
print(ret)


import functools
from functools import reduce
s = input()

def f(a):
	if ord(a) >= 65 and ord(a) <= 90:
		return ord(a.lower())
	elif ord(a) >= 97 and ord(a) <= 123:
		return ord(a.upper())
	else:
		c = int(a)
		if c % 2 == 0:
			return ord(a) + 150
		else:
			return ord(a) + 100
s = list(sorted(s, key=lambda x: f(x)))
l = reduce(lambda a, b: a + b, s)
print(l)


from functools import cmp_to_key

def cmp(a, b):
	if a == b:
		return 0
	if a.isdigit() and b.isdigit():
		if int(a) % 2 != 0 and int(b) % 2 == 0:
			return -1
		elif int(a) % 2 == 0 and int(b) % 2 != 0:
			return 1
		else:
			return -1 if a < b else 1
	if a.islower() and b.islower() or (a.isupper() and b.isupper()):
		return -1 if a < b else 1
	if a.islower():
		return -1
	if a.isupper() and b.isdigit():
		return -1
	elif a.isupper() and b.islower():
		return 1
	if a.isdigit():
		return 1
	return 1

def cmpstr(a, b):
	return cmp(a, b)

def main():
	s = input()
	print(*list(sorted(s, key=cmp_to_key(cmpstr))), sep='')
main()


from functools import reduce
s = input()
s = sorted(s)
minusculas = filter(lambda x: x.isalpha() and x.islower(), s)
mayusculas = filter(lambda x: x.isalpha() and x.isupper(), s)
impares = filter(lambda x: x.isdigit() and int(x) % 2 != 0, s)
pares = filter(lambda x: x.isdigit() and int(x) % 2 == 0, s)
total = list(minusculas) + list(mayusculas) + list(impares) + list(pares)
print(reduce(lambda x, y: x + y, total))


from functools import reduce
s = input()

def poids(c):
	chiffres = list('0123456789')
	if c in chiffres:
		if int(c) % 2 == 0:
			return (1, 1, int(c))
		else:
			return (1, 0, int(c))
	elif c.isupper():
		return (0, 1, c)
	else:
		return (0, 0, c)
print(reduce(lambda x, y: x + y, sorted(s, key=poids)))


from functools import reduce
import re
totstr = reduce(lambda x, y: x + y, sorted(input()))
S = re.findall('[a-z]+', totstr)
C = re.findall('[A-Z]+', totstr)
N = re.findall('[0-9]+', totstr)
oddstr = ''
evenstr = ''
if len(N) > 0:
	evenstr = reduce(lambda x, y: x + y, map(str, filter(lambda x: x % 2 == 0, map(int, list(N[0])))))
	oddstr = reduce(lambda x, y: x + y, map(str, filter(lambda x: x % 2 != 0, map(int, list(N[0])))))
if len(S) > 0 and len(C) > 0:
	print(S[0] + C[0] + oddstr + evenstr)
elif len(S) > 0:
	print(S[0] + oddstr + evenstr)
elif len(C) > 0:
	print(C[0] + oddstr + evenstr)
else:
	print(oddstr + evenstr)


import string
S = input()
pairs = dict(zip(string.ascii_lowercase, list(range(26))))
pairs.update(dict(zip(string.ascii_uppercase, list(range(26, 52)))))
pairs.update(dict(zip(string.digits, [57, 52, 58, 53, 59, 54, 60, 55, 61, 56])))
print(*sorted(S, key=lambda element: pairs[element]), sep='')


s = input()
s = sorted(s, key=lambda x: (x.isdigit() and int(x) % 2 == 0, x.isdigit(), x.isupper(), x.islower(), x))
print(*s, sep='')


val = list('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1357902468')
ds = dict(list(zip(val, list(range(62)))))
xs = input()
ws = sorted(xs, key=lambda x: ds[x])
print(*ws, sep='')


from functools import reduce

def compare(i):
	i = ord(i)
	if i < 58:
		i += 100
		if not i % 2:
			i += 10
	elif i > 96:
		i -= 32
	else:
		i += 32
	return i
print(reduce(lambda a, b: a + b, sorted(input(), key=compare)))


import re
s = input()
p1 = '[a-z]'
p2 = '[A-Z]'
p3 = '[13579]'
p4 = '[02468]'
s1 = re.findall(p1, s)
s2 = re.findall(p2, s)
s3 = re.findall(p3, s)
s4 = re.findall(p4, s)
s1.sort()
s2.sort()
s3.sort()
s4.sort()
print(*s1 + s2 + s3 + s4, sep='')


import string
S = input()

def key(e):
	if e in string.ascii_lowercase:
		return (1, e)
	elif e in string.ascii_uppercase:
		return (2, e)
	elif int(e) % 2 == 1:
		return (3, e)
	else:
		return (4, e)
W = sorted(S, key=key)
print(*W, sep='')


def sorter(x):
	if x.islower():
		return ord(x) + 30
	if x.isupper():
		return ord(x) + 300
	if ord(x) % 2 == 0:
		return ord(x) + 1200
	return ord(x) + 1000

def toStr(x):
	if x == []:
		return ''
	l = len(x)
	if l == 1:
		return x[0]
	return toStr(x[:int(l / 2)]) + toStr(x[int(l / 2):])
x = input()
l = sorted(x, key=sorter)
print(toStr(l))


from functools import reduce
S = input()
L = list(filter(lambda s: s.islower(), S))
L.sort()
U = list(filter(lambda s: s.isupper(), S))
U.sort()
D = list(filter(lambda d: d.isdigit(), S))
Do = list(filter(lambda d: int(d) % 2 == 1, D))
Do.sort()
De = list(filter(lambda d: int(d) % 2 == 0, D))
De.sort()
print(reduce(lambda x, y: x + y, L + U + Do + De))


import functools
s = input()
lst = list(sorted(s, key=lambda x: (x.isnumeric() and int(x) % 2 == 0, x.isnumeric() and int(x) % 2 == 1, x.isupper(), x.islower(), x)))
print(functools.reduce(lambda x, y: x + y, lst))


from functools import reduce

def f(c):
	x = ord(c)
	if x < ord('A'):
		x += 200
		if x % 2 == 0:
			x += 100
	elif x < ord('a'):
		x += 100
	return x

def c(c1, c2):
	return c1 + c2
s = input()
s = sorted(s, key=f)
s = reduce(c, s)
print(s)


import string, functools
print(functools.reduce(lambda x, y: x + y, sorted(input(), key=lambda s: 100000000 * (ord(s) - ord('0') + 1) if s in '02468' else 1000000 * (ord(s) - ord('0') + 1) if s in '13579' else ord(s) if s in string.ascii_lowercase else ord(s) + 300)))


def h(x):
	if x.islower():
		return ord(x) - ord('a')
	if x.isupper():
		return 100 + ord(x) - ord('A')
	if int(x) % 2 == 1:
		return 200 + ord(x) - ord('0')
	return 300 + ord(x) - ord('0')
s = input()
l = sorted(s, key=h)
print(str(l)[1:-1].replace("'", '').replace(', ', ''))


S = str(input())
sortPriority = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25, 'A': 26, 'B': 27, 'C': 28, 'D': 29, 'E': 30, 'F': 31, 'G': 32, 'H': 33, 'I': 34, 'J': 35, 'K': 36, 'L': 37, 'M': 38, 'N': 39, 'O': 40, 'P': 41, 'Q': 42, 'R': 43, 'S': 44, 'T': 45, 'U': 46, 'V': 47, 'W': 48, 'X': 49, 'Y': 50, 'Z': 51, '0': 57, '1': 52, '2': 58, '3': 53, '4': 59, '5': 54, '6': 60, '7': 55, '8': 61, '9': 56}

def keyFcn(char):
	return sortPriority[char]
S = sorted(S, key=keyFcn)
solutionList = ['']
list(map(lambda x: solutionList.append(solutionList[x] + S[x]), iter(range(len(S)))))
print(solutionList[-1])


from functools import reduce
__author__ = 'gauth_000'
string = reduce(lambda x, y: x + y, sorted(input()))
try:
	print(reduce(lambda x, y: x + y, filter(lambda x: x.islower(), string)), end='')
	print(reduce(lambda x, y: x + y, filter(lambda x: x.isupper(), string)), end='')
	print(reduce(lambda x, y: x + y, filter(lambda x: x.isdigit() and int(x) % 2, string)), end='')
	print(reduce(lambda x, y: x + y, filter(lambda x: x.isdigit() and (not int(x) % 2), string)), end='')
except:
	pass


a = input()

def k(x):
	if x.islower():
		return ord(x) - ord('a')
	elif x.isupper():
		return 30 + ord(x) - ord('A')
	elif x.isnumeric():
		c = ord(x) - ord('0')
		if c % 2 == 1:
			return 100 + c
		else:
			return 1000 + c
print('%s' * len(a) % tuple(sorted(a, key=k)))


import string
data = sorted(input())
lowcase = list(filter(lambda x: x in string.ascii_lowercase, data))
uppcase = list(filter(lambda x: x in string.ascii_uppercase, data))
digit = list(filter(lambda x: x in string.digits, data))
result = lowcase + uppcase + list(filter(lambda x: int(x) % 2 != 0, digit)) + list(filter(lambda x: int(x) % 2 == 0, digit))
print(*result, sep='')


import operator, functools

def func(x):
	if x.isdigit():
		return int(x) % 2 != 1
	else:
		return x
print(functools.reduce(operator.add, sorted(list(input()), key=lambda x: (x.isdigit(), x.isupper(), x.islower(), func(x), x))))


def cmp(x):
	if x.islower():
		return ord(x)
	elif x.isupper():
		return ord(x) + ord('z')
	elif int(x) % 2 == 1:
		return ord(x) + 1000
	else:
		return ord(x) + 10000
print(*sorted(input(), key=cmp), sep='')


import functools

def keyfunc(character):
	if character.islower():
		return ord(character) - 97
	if character.isupper():
		return ord(character)
	if character.isdigit():
		if int(character) % 2 != 0:
			return (int(character) + 1) * 100
		else:
			return (int(character) + 1) * 1001
to_sort = input()
print(functools.reduce(lambda x, y: x + y, sorted(to_sort, key=keyfunc)))


def comp(x):
	if x.isalpha():
		if x.isupper():
			return ord(x) + 200
		if not x.isupper():
			return ord(x)
	elif x.isdigit():
		if int(x) % 2 == 0:
			return ord(x) + 1000
		else:
			return ord(x) + 500
print(*sorted(input(), key=comp), sep='')


import functools
s = input()
print(functools.reduce(lambda l, t: l + t, sorted(s, key=lambda x: (x[0].isdigit() and int(x[0]) % 2 == 0, x[0].isdigit() and int(x[0]) % 2 != 0, x[0].isupper(), x[0].islower(), x))))


from operator import add
from functools import reduce
s = input()
k = sorted(s, key=lambda x: (x.isdigit(), x.isupper(), x.islower(), x.isdigit() and int(x) % 2 == 0, x))
print(reduce(add, k))


import sys
import string
input_string = input()
digit_penalty = 10000
upper_penalty = 5000

def ginorts(key):
	if key.isdigit():
		if int(key) % 2 == 0:
			return int(key) + digit_penalty * 2
		return int(key) + digit_penalty
	elif key.isupper():
		return string.ascii_uppercase.index(key) + upper_penalty
	elif key.islower():
		return string.ascii_lowercase.index(key)
	else:
		return key
print(*sorted(input_string, key=lambda x: ginorts(x)), sep='')


import functools

def myVal(s):
	if s.islower():
		return ord(s) - ord('a')
	elif s.isupper():
		return ord(s) - ord('A') + 100
	elif int(s) % 2 == 1:
		return int(s) + 200
	else:
		return int(s) + 300
S = input()
listSortedS = sorted(S, key=myVal)
print(functools.reduce(lambda x, y: x + y, listSortedS))


def iseven(c):
	return c in '02468'
print(*sorted(input(), key=lambda c: (iseven(c), str.isdigit(c), str.isupper(c), c)), sep='')


def getValue(c):
	sum = ord(c)
	if c.isalpha():
		if not c.islower():
			sum += 1000
	elif int(c) % 2 == 1:
		sum += 2000
	else:
		sum += 3000
	return sum
print(*sorted(input(), key=getValue), sep='')


from functools import reduce
data = list(input().strip())

def key(s):
	if s.isdigit():
		if int(s) % 2 == 0:
			return (ord('z') - ord('0'), 1, ord(s))
		else:
			return (ord('z') - ord('0'), 0, ord(s))
	if s.isupper():
		return (ord('z') - ord('A'), ord(s))
	else:
		return (ord('z') - ord('a'), ord(s))
print(reduce(lambda x, y: x + y, sorted(data, key=key)))


import string

def key(value):
	if value in string.ascii_lowercase:
		return ord(value) - ord(string.ascii_lowercase[0])
	elif value in string.ascii_uppercase:
		return ord(value) - ord(string.ascii_uppercase[0]) + len(string.ascii_lowercase)
	elif int(value) % 2 == 1:
		return int(value) / 2 + len(string.ascii_lowercase) + len(string.ascii_uppercase)
	else:
		return int(value) / 2 + len(string.ascii_lowercase) + len(string.ascii_uppercase) + 10 // 2

def run():
	data = input()
	print('%c' * len(data) % tuple(sorted(data, key=key)))
run()


WEIGHT = 1000

def ginorts_key(c):
	if c.islower():
		return ord(c)
	elif c.isupper():
		return WEIGHT + ord(c)
	elif int(c) % 2 == 1:
		return WEIGHT * 2 + ord(c)
	else:
		return WEIGHT * 3 + ord(c)

def ginorts(s):
	return sorted(s, key=ginorts_key)
print(*ginorts(input()), sep='')


def sorting(w):
	if w.isdigit():
		i = int(w)
		if i % 2 == 1:
			return 148 + ord(w) - 47
		else:
			return 148 + ord(w) - 47 + 10
	elif w.isupper():
		return 122 + ord(w) - 64
	else:
		return ord(w)
s = list(input())
s = sorted(s, key=sorting)
import re
print(re.sub('[^A-Za-z0-9]+', '', str(s)))


def comparer(c):
	if c.islower():
		return ord(c) - 123
	elif c.isupper():
		return ord(c) - 65
	elif c.isdigit():
		if int(c) % 2 != 0:
			return ord(c)
		else:
			return ord(c) + 10
print(*sorted(input(), key=comparer), sep='')


s = input()
k = sorted(s, key=lambda x: (x.isdigit(), x.isupper(), x.islower(), x.isdigit() and int(x) % 2 == 0, x))
j = str(k).strip("[],''")
j = j.replace(',', '')
j = j.replace("'", '')
j = j.replace(' ', '')
print(j)


s = input()
s = sorted(s, key=lambda a: ord(a) if a >= 'a' and a <= 'z' else ord(a) + 1000 if a >= 'A' and a <= 'Z' else ord(a) + 2000 if (ord(a) - ord('0')) % 2 == 1 else ord(a) + 3000)
print(*s, sep='')


def key_function(x):
	c = ord(x)
	if 96 < c:
		return c * 10 ** 1
	if 64 < c:
		return c * 10 ** 2
	if int(x) % 2:
		return c * 10 ** 3
	else:
		return c * 10 ** 4
b = bytearray(map(lambda x: ord(x), sorted(input(), key=key_function)))
print(str(b.decode('utf-8')))


from functools import reduce
from operator import add

def get_key(i):
	if i.isdigit():
		if int(i) % 2 == 0:
			return 1000000 + int(i)
		else:
			return 10000 + int(i)
	if i.islower():
		return ord(i)
	if i.isupper():
		return 500 + ord(i)
print(reduce(add, sorted(input().strip(), key=get_key)))


def f(c):
	if c.islower():
		return 100 + 'abcdefghijklmnopqrstuvwxyz'.index(c)
	if c.isupper():
		return 200 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.index(c)
	if c in '13579':
		return 300 + '13579'.index(c)
	if c in '02468':
		return 400 + '02468'.index(c)
print(*sorted(input(), key=f), sep='')


s = input().encode('ascii')
print(bytes(sorted(s, key=lambda x: (x + 1000 if x % 2 else x + 2000) if x < 65 else x + 500 if x < 96 else x)).decode('ascii'))


from array import array
s = input()
small = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
large = {'A': 27, 'B': 28, 'C': 29, 'D': 30, 'E': 31, 'F': 32, 'G': 33, 'H': 34, 'I': 35, 'J': 36, 'K': 37, 'L': 38, 'M': 39, 'N': 40, 'O': 41, 'P': 42, 'Q': 43, 'R': 44, 'S': 45, 'T': 46, 'U': 47, 'V': 48, 'W': 49, 'X': 50, 'Y': 51, 'Z': 52}
numb = {'1': 53, '3': 54, '5': 55, '7': 56, '9': 57, '0': 58, '2': 59, '4': 60, '6': 61, '8': 62}
x = small.copy()
x.update(large)
x.update(numb)
W = sorted(s, key=lambda i: x[i])
K = array('B', map(ord, W)).tostring()
K = K.decode('utf-8')
print(K)


S = input()
ans = ''
ans += 'a' * S.count('a')
ans += 'b' * S.count('b')
ans += 'c' * S.count('c')
ans += 'd' * S.count('d')
ans += 'e' * S.count('e')
ans += 'f' * S.count('f')
ans += 'g' * S.count('g')
ans += 'h' * S.count('h')
ans += 'i' * S.count('i')
ans += 'j' * S.count('j')
ans += 'k' * S.count('k')
ans += 'l' * S.count('l')
ans += 'm' * S.count('m')
ans += 'n' * S.count('n')
ans += 'o' * S.count('o')
ans += 'p' * S.count('p')
ans += 'q' * S.count('q')
ans += 'r' * S.count('r')
ans += 's' * S.count('s')
ans += 't' * S.count('t')
ans += 'u' * S.count('u')
ans += 'v' * S.count('v')
ans += 'w' * S.count('w')
ans += 'x' * S.count('x')
ans += 'y' * S.count('y')
ans += 'z' * S.count('z')
ans += 'A' * S.count('A')
ans += 'B' * S.count('B')
ans += 'C' * S.count('C')
ans += 'D' * S.count('D')
ans += 'E' * S.count('E')
ans += 'F' * S.count('F')
ans += 'G' * S.count('G')
ans += 'H' * S.count('H')
ans += 'I' * S.count('I')
ans += 'J' * S.count('J')
ans += 'K' * S.count('K')
ans += 'L' * S.count('L')
ans += 'M' * S.count('M')
ans += 'N' * S.count('N')
ans += 'O' * S.count('O')
ans += 'P' * S.count('P')
ans += 'Q' * S.count('Q')
ans += 'R' * S.count('R')
ans += 'S' * S.count('S')
ans += 'T' * S.count('T')
ans += 'U' * S.count('U')
ans += 'V' * S.count('V')
ans += 'W' * S.count('W')
ans += 'X' * S.count('X')
ans += 'Y' * S.count('Y')
ans += 'Z' * S.count('Z')
ans += '1' * S.count('1')
ans += '3' * S.count('3')
ans += '5' * S.count('5')
ans += '7' * S.count('7')
ans += '9' * S.count('9')
ans += '0' * S.count('0')
ans += '2' * S.count('2')
ans += '4' * S.count('4')
ans += '6' * S.count('6')
ans += '8' * S.count('8')
print(ans)


from functools import reduce
Mylist = list(input())
Mylist.sort()
Mylist.sort(key=lambda elem: (int(elem) + 1) % 2 if elem.isdigit() else False)
Mylist.sort(key=lambda x: x.isupper())
Mylist.sort(key=lambda x: x.isdigit())
A = reduce(lambda x, y: x + y, Mylist)
print(A)


from functools import reduce

def iseven(s):
	try:
		return int(s) % 2 == 0
	except:
		return False
S = input()
srt = sorted(list(S), key=lambda l: (iseven(l), l.isdigit(), l.isupper(), l.islower(), l))
print(reduce(str.__add__, srt))


sort_order = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1357902468'
sort_d_input = sorted(input(), key=lambda c: sort_order.index(c))
print(*sort_d_input, sep='')


from functools import reduce

def hoge(s):
	c = ord(s)
	if s >= '0' and s <= '9':
		return c + 1000 - c % 2 * 100
	if s >= 'A' and s <= 'Z':
		return c + 100
	return c
s = input().strip()
print(reduce(lambda x, y: x + y, sorted(s, key=hoge)))


from functools import reduce
s = list(input())
low = []
up = []
e = []
o = []

def sp(x):
	if x.islower():
		low.append(x)
	elif x.isupper():
		up.append(x)
	elif x.isdigit():
		if int(x) % 2 == 0:
			e.append(x)
		else:
			o.append(x)
list(map(sp, s))
low.sort()
up.sort()
e.sort()
o.sort()
f = low
f.extend(up)
f.extend(o)
f.extend(e)
print(reduce(lambda x, y: x + y, f))


import string
d = string.ascii_lowercase + string.ascii_uppercase + '1357902468'
S = input()
print(str(sorted(S, key=d.index)).replace('[', '').replace("'", '').replace(', ', '').replace(']', ''))


s = input()

def isDOE(ch):
	if ch.isdigit():
		return (int(ch) + 1) % 2
	else:
		return -1
s = sorted(s, key=lambda x: (isDOE(x), x.isupper(), x))
list(map(lambda a: print(a, end=''), s))


import sys, string

def sorting_key(item):
	if 97 <= ord(item) <= 122:
		return ord(item)
	if 65 <= ord(item) <= 95:
		return 100 + ord(item)
	if 48 <= ord(item) <= 57:
		return 200 + ord(item) + 100 * ((ord(item) + 1) % 2)
inp = list(input())
print(*sorted(inp, key=sorting_key), sep='')


print(*sorted(input(), key=lambda c: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1357902468'.index(c)), sep='')


import operator
from functools import cmp_to_key, reduce

def comparator(x, y):
	rank = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '3', '5', '7', '9', '0', '2', '4', '6', '8']
	return rank.index(x) - rank.index(y)
ls = sorted(list(input()), key=cmp_to_key(comparator))
print(reduce(operator.add, ls))


def modulo2(x):
	if x.isdigit():
		if int(x) % 2 == 0:
			return 1
		else:
			return 0
	else:
		return -1
s = list(input())
print(*sorted(s, key=lambda el: (modulo2(el), el.isdigit(), el.isupper(), el)), sep='')


import functools

def f(x):
	if x in '13579':
		return 3
	elif x in '02468':
		return 4
	elif x.isupper():
		return 2
	else:
		return 1
	return 0
print(functools.reduce(lambda acc, s: acc + s, sorted(input(), key=lambda x: [f(x), x])))


import re

def al(y):
	if y.islower():
		return ord(y) - 96
	elif y.isupper():
		return ord(y) - 60 + 100
	elif ord(y) % 2 == 1:
		return ord(y) - 47 + 1000
	else:
		return ord(y) - 47 + 2000
x = input()
z = sorted(x, key=al)
z = str(z)
z = re.sub("[, '\\]\\[]", '', z)
print(z)


inp = input()
uc = []
lc = []
ev = []
od = []

def call_s(l, k):
	l.sort(key=k)

def a(s):
	if s.isupper():
		uc.append(s)
		str.upper
	elif s.islower():
		lc.append(s)
		str.lower
	elif int(s) % 2 == 0:
		ev.append(s)
	else:
		od.append(s)
list(map(a, inp))
lol = [lc, uc, od, ev]
lok = [str.lower, str.upper, int, int]
list(map(call_s, lol, lok))

def pp(l):
	f_s = str(l)[1:-1].replace("''", '')
	list(map(lambda x: print(x, end=''), l))
list(map(pp, lol))


from functools import reduce

def ord1(c):
	if c.islower():
		return ord(c) - 97
	elif c.isupper():
		return ord(c) - 39
	elif int(c) % 2 == 1:
		return int(c) + 52
	else:
		return int(c) + 62
l = sorted(input(), key=ord1)
s = reduce(lambda x, y: x + y, l)
print(s)


line = input()

def mapper(x):
	if 'a' <= x and x <= 'z':
		return ord(x) - ord('a')
	if 'A' <= x and x <= 'Z':
		return ord(x) - ord('A') + 26
	if x in '13579':
		return (ord(x) - ord('1')) / 2 + 52
	return (ord(x) - ord('0')) / 2 + 60
print(*sorted(line, key=mapper), sep='')


S = input()

def s(x):
	if x.islower():
		return ord(x)
	elif x.isupper():
		return ord(x) * 100000
	elif x in '13579':
		return ord(x) * 10000000000
	else:
		return ord(x) * 1000000000000000000
print(*sorted(S, key=s), sep='')


def f(c):
	code = 0
	if c.isupper():
		code = 10 ** 3
	elif c.isdigit():
		code = 10 ** 6
		if ord(c) % 2 == 0:
			code = 10 ** 9
	return code + ord(c)
print(*sorted(input(), key=lambda c: f(c)), sep='')


import string
import functools
s = input()
print(functools.reduce(lambda a, b: a + b, sorted(s, key=lambda x: (string.ascii_lowercase + string.ascii_uppercase + '1357902468').index(x))))


def getVal(c):
	if ord(c) in range(ord('a'), ord('z')):
		return ord(c) - ord('a')
	if ord(c) in range(ord('A'), ord('Z')):
		return ord(c) - ord('A') + 26
	if ord(c) in range(ord('1'), ord('9'), 2):
		return ord(c) - ord('1') + 52
	if ord(c) in range(ord('0'), ord('8')):
		return ord(c) - ord('0') + 62
	return ord(c) + 72
s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1357902468'
print(*sorted(input(), key=lambda x: s.index(x)), sep='')


from functools import reduce
line = input()

def theKeyWasADK(x):
	if x >= 'a' and x <= 'z':
		return ord(x) - ord('a')
	elif x >= 'A' and x <= 'Z':
		return ord(x) - ord('A') + 26
	elif x in ['1', '3', '5', '7', '9']:
		return (ord(x) - ord('1')) // 2 + 52
	else:
		return (ord(x) - ord('0')) // 2 + 57
print(reduce(lambda x, y: str(x) + str(y), sorted(line, key=theKeyWasADK)))


from functools import reduce

def ginorts(x):
	if x.isdigit():
		if int(x) % 2 == 0:
			return 10 - int(x)
		else:
			return 20 - int(x)
	elif ord(x) > 96:
		return 96 * 2 - ord(x)
	else:
		return 65 * 2 - ord(x)
A = sorted(input(), key=ginorts, reverse=True)
A = reduce(lambda x, y: x + y, A)
print(A)


import string
import re
index = []
index += string.ascii_lowercase
index += string.ascii_uppercase
index += ['1', '3', '5', '7', '9']
index += ['0', '2', '4', '6', '8']
s = str(sorted(input().strip(), key=lambda c: index.index(c)))
print(re.sub('[^A-Za-z0-9]', '', s))


import re
import operator
from array import array
s = input()
small = re.sub('[^a-z]', '', s)
upper = re.sub('[^A-Z]', '', s)
numbers = re.sub('[^0-9]', '', s)
numbers = list(map(int, numbers))

def findodd(n):
	odd = ''
	if n % 2 != 0:
		odd += str(n)
	return odd

def findeven(n):
	even = ''
	if n % 2 == 0:
		even += str(n)
	return even
convstring = lambda n: str(n)
convS = lambda x: array('B', map(ord, x)).tostring().decode('utf-8')
odd = list(map(findodd, numbers))
even = list(map(findeven, numbers))
odd = list(filter(lambda x: x != '', odd))
even = list(filter(lambda x: x != '', even))
full = [small, upper, odd, even]
mysort = list(map(lambda x: sorted(x), full))
slist = mysort
slist = list(map(convS, mysort))
print(*slist, sep='')


def my_ord(ch):
	val = ord(ch)
	if ch.isdigit():
		if int(ch) % 2 == 0:
			val += 300
		else:
			val += 200
	elif ch.isupper():
		val += 100
	return val
s = input()
s = sorted(s, key=my_ord)
print(*s, sep='')


from functools import reduce

def fn(x):
	if not x.isdigit():
		return (False, False, 1)
	else:
		return (True, int(x) % 2 == 0, ord(x))
s = list(input())
s.sort(key=lambda x: (65 <= ord(x) <= 90, ord(x)))
s.sort(key=fn)
print(reduce(lambda x, y: x + y, s))


def sorter(letter):
	code = ord(letter)
	if code > 64 and code < 91:
		code += 1000
	if code > 47 and code < 58:
		if code % 2 == 0:
			code += 10000000
		else:
			code += 100000
	return code
string = input()
sortvalue = sorted(string, key=sorter)
print(*sortvalue, sep='')


def cmp_to_key(mycmp):

	class K:

		def __init__(self, obj, *args):
			self.obj = obj

		def __lt__(self, other):
			return mycmp(self.obj, other.obj) < 0

		def __gt__(self, other):
			return mycmp(self.obj, other.obj) > 0

		def __eq__(self, other):
			return mycmp(self.obj, other.obj) == 0

		def __le__(self, other):
			return mycmp(self.obj, other.obj) <= 0

		def __ge__(self, other):
			return mycmp(self.obj, other.obj) >= 0

		def __ne__(self, other):
			return mycmp(self.obj, other.obj) != 0
	return K

def compare(a, b):
	a = chr(a)
	b = chr(b)
	if a.isdigit() and b.isdigit():
		if int(a) % 2 == 1 and int(b) % 2 == 0:
			return -1
		elif int(a) % 2 == 0 and int(b) % 2 == 1:
			return 1
		else:
			return ord(a) - ord(b)
	elif a.islower() and b.islower():
		return ord(a) - ord(b)
	elif a.isupper() and b.isupper():
		return ord(a) - ord(b)
	else:
		return ord(b) - ord(a)
myString = bytearray(map(ord, input().strip()))
outString = sorted(myString, key=cmp_to_key(compare))
print(str(bytes(outString))[2:-1])


def cmp_char(c):
	c = ord(c)
	if 65 <= c <= 90:
		c += 100
	elif 48 <= c <= 57:
		if c % 2:
			c += 200
		else:
			c += 300
	return c

def main():
	s = input()
	res = sorted(s, key=cmp_char)
	s = str(res)
	s = s.replace('[', '')
	s = s.replace(']', '')
	s = s.replace("'", '')
	s = s.replace(',', '')
	s = s.replace(' ', '')
	print(s)
	return
main()


__author__ = 'namii'

def key_function(x):
	if x.islower():
		return ord(x) - 500
	if x.isupper():
		return ord(x) - 200
	if int(x) % 2 == 1:
		return ord(x) + 200
	if int(x) % 2 == 0:
		return ord(x) + 400

def ginorts(sentence):
	return str(sorted(sentence, key=key_function))
input_string = input()
outputti = ginorts(input_string)
print(outputti.replace(', ', '').replace("'", '').replace('[', '').replace(']', ''))


print(*sorted(input(), key=lambda a: ord(a) + ((10000 if int(a) % 2 == 0 else 1000) if a.isdigit() else 100 if a.isupper() else 0)), sep='')


s = input()

def MyFn(i):
	return (i.isdigit(), i.isupper(), i.isdigit() and int(i) % 2 == 0, i)
ans = repr(sorted(s, key=MyFn))[2::5]
print(ans)