You are given a ternary string (it is a string which consists only of characters '0', '1' and '2').

You can swap any two adjacent (consecutive) characters '0' and '1' (i.e. replace "01" with "10" or vice versa) or any two adjacent (consecutive) characters '1' and '2' (i.e. replace "12" with "21" or vice versa).

For example, for string "010210" we can perform the following moves:   "010210" $\rightarrow$ "100210";  "010210" $\rightarrow$ "001210";  "010210" $\rightarrow$ "010120";  "010210" $\rightarrow$ "010201". 

Note than you cannot swap "02" $\rightarrow$ "20" and vice versa. You cannot perform any other operations with the given string excluding described above.

You task is to obtain the minimum possible (lexicographically) string by using these swaps arbitrary number of times (possibly, zero).

String $a$ is lexicographically less than string $b$ (if strings $a$ and $b$ have the same length) if there exists some position $i$ ($1 \le i \le |a|$, where $|s|$ is the length of the string $s$) such that for every $j < i$ holds $a_j = b_j$, and $a_i < b_i$.


-----Input-----

The first line of the input contains the string $s$ consisting only of characters '0', '1' and '2', its length is between $1$ and $10^5$ (inclusive).


-----Output-----

Print a single string — the minimum possible (lexicographically) string you can obtain by using the swaps described above arbitrary number of times (possibly, zero).


-----Examples-----
Input
100210

Output
001120

Input
11222121

Output
11112222

Input
20

Output
20

Difficulty: MEDIUM

Solutions:
s = input()
ones = s.count('1')
s_tmp = s.split('2')
s_out = s_tmp[0].count('0') * '0' + ones * '1'
for pocket in s_tmp[1:]:
	s_out += '2' + pocket.count('0') * '0'
print(s_out)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
s = input()
n = len(s)
s += '2'
z = s.count('1')
ans = []
flag = 0
for i in range(len(s)):
	if s[i] == '2' and flag == 0:
		for j in range(z):
			ans.append('1')
		flag = 1
		ans.append('2')
	elif s[i] != '1':
		ans.append(s[i])
ans = ans[:n]
print(''.join(ans))


from __future__ import print_function
import sys
import math
import os.path
import random
from copy import deepcopy
from functools import reduce
from collections import Counter, ChainMap, defaultdict
from itertools import cycle, chain
from queue import Queue, PriorityQueue
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, nlargest, nsmallest
import bisect
from statistics import mean, mode, median, median_low, median_high
sys.setrecursionlimit(10 ** 9)

def log(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def ni():
	return map(int, input().split())

def nio(offset):
	return map(lambda x: int(x) + offset, input().split())

def nia():
	return list(map(int, input().split()))

def toString(aList, sep=' '):
	return sep.join((str(x) for x in aList))

def toMapInvertIndex(aList):
	return {k: v for (v, k) in enumerate(aList)}

def sortId(arr):
	return sorted(range(arr), key=lambda k: arr[k])
s = input()
ls = len(s)
kq = ''
c1 = 0
for c in s:
	if c == '1':
		c1 += 1
	else:
		kq += c
if c1 == ls:
	kq = s
elif c1 > 0:
	c2 = kq.find('2')
	if c2 > -1:
		kq = kq[:c2] + '1' * c1 + kq[c2:]
	else:
		kq = kq + '1' * c1
print(kq)


s = input()
t = s.count('1')
s = s.replace('1', '')
i = s.find('2')
if i == -1:
	print(s + '1' * t)
else:
	print(s[:i] + '1' * t + s[i:])


def main():
	s = list(map(int, input()))
	(cnt0, cnt1) = (0, 0)
	ans = []
	for a in s:
		if a == 1:
			cnt1 += 1
		elif a == 2:
			ans.append(a)
		elif a == 0:
			if not ans:
				cnt0 += 1
			else:
				ans.append(a)
	s = '0' * cnt0 + '1' * cnt1 + ''.join(map(str, ans))
	print(s)

def __starting_point():
	main()
__starting_point()


s = input()
d = [0, 0]
i = 0
while i < len(s) and s[i] != '2':
	d[int(s[i])] += 1
	i += 1
a1 = 0
a2 = ''
while i < len(s):
	if s[i] == '1':
		a1 += 1
	else:
		a2 += s[i]
	i += 1
print('0' * d[0] + '1' * d[1] + '1' * a1 + a2)


s = input()
x1 = s.count('1')
if s.count('2') == 0:
	print(s.count('0') * '0' + x1 * '1')
else:
	x = s.index('2')
	s1 = s[:x]
	s2 = s[x:]
	x0 = s1.count('0')
	s2 = s2.replace('1', '')
	print('0' * x0 + '1' * x1 + s2)


s = input()
ones = 0
a = []
for i in s:
	if i == '1':
		ones += 1
	else:
		a.append(i)
two = -1
for i in range(len(a)):
	if a[i] == '2' and two == -1:
		print(ones * '1', end='')
		two = i
	print(a[i], end='')
if two == -1:
	print(ones * '1', end='')


s = input()
ones = s.count('1')
s = s.replace('1', '')
indTwo = s.find('2')
if indTwo != -1:
	print(s[:indTwo] + '1' * ones + s[indTwo:])
else:
	print(s + '1' * ones)


s = input()
ans = ''
count_0 = 0
count_1 = 0
done = False
for val in s:
	if val == '0':
		if not done:
			count_0 += 1
		else:
			ans += val
	if val == '1':
		count_1 += 1
	if val == '2':
		done = True
		ans += val
print(''.join(['0'] * count_0) + ''.join(['1'] * count_1) + ans)


s = input()
t = [x for x in s if x != '1']
if not t:
	print(s)
else:
	o = ['1'] * (len(s) - len(t))
	try:
		i = t.index('2')
		print(''.join(t[:i] + o + t[i:]))
	except ValueError:
		print(''.join(t + o))


string = input()
string = [x for x in string]
count_0 = []
count_1 = []
count_2 = []
counting_0 = 0
counting_1 = 0
counting_2 = 0
for number in string:
	if number == '1':
		counting_1 += 1
	elif number == '0':
		counting_0 += 1
	else:
		count_0.append(counting_0)
		counting_0 = 0
		count_2.append('2')
count_0.append(counting_0)
count_1.append(counting_1)
answer = []
first = True
for (idx, qtd_0) in enumerate(count_0):
	while qtd_0 > 0:
		answer.append('0')
		qtd_0 -= 1
	while count_1[0] and first:
		answer.append('1')
		count_1[0] -= 1
	first = False
	if len(count_0) > 1 and idx < len(count_2) and (count_2[idx] == '2'):
		answer.append('2')
print(''.join(answer))


s = input()
s1 = []
s2 = []
s3 = []
f = 0
for i in range(0, len(s)):
	if s[i] == '1':
		s2.append('1')
	else:
		if s[i] == '2':
			f = 1
		if f == 1:
			s3.append(s[i])
		else:
			s1.append(s[i])
print(''.join(s1 + s2 + s3))


s = input()
k1 = 0
for i in s:
	if i == '1':
		k1 += 1
k0 = 0
for i in s:
	if i == '0':
		k0 += 1
	if i == '2':
		break
ans = '0' * k0 + '1' * k1
i = 0
while i < len(s):
	if s[i] == '2':
		ans += '2'
		i += 1
		while i < len(s) and s[i] != '2':
			if s[i] == '0':
				ans += '0'
			i += 1
	else:
		i += 1
print(ans)


tenaryString = input()
numberOfOnes = tenaryString.count('1')
indexOffirstTwo = tenaryString.find('2')
if indexOffirstTwo == -1:
	indexOffirstTwo = len(tenaryString)
temp = tenaryString[:indexOffirstTwo]
numberOfZeros = temp.count('0')
result = '0' * numberOfZeros + '1' * numberOfOnes + tenaryString[indexOffirstTwo:].replace('1', '')
print(result)


s = [i for i in input()]
n = len(s)
c = 0
p = 1 << 64
ans = ''
for i in range(n):
	if s[i] == '1':
		c += 1
	else:
		ans += s[i]
for i in range(len(ans)):
	if ans[i] == '2':
		p = min(p, i)
if p == 1 << 64:
	ans += c * '1'
	print(ans)
else:
	s1 = ans[0:p]
	s2 = ans[p:]
	print(s1 + '1' * c + s2)


s = str(input())
answer = []
ed_count = 0
prev_null = 0
prev_twos = 0
for el in s:
	if el == '1':
		ed_count += 1
	elif el == '0':
		if prev_null == 0:
			if prev_twos != 0:
				answer.append([2, prev_twos])
				prev_twos = 0
		prev_null += 1
	else:
		if prev_twos == 0:
			if prev_null != 0:
				answer.append([0, prev_null])
				prev_null = 0
		prev_twos += 1
if prev_twos != 0:
	answer.append([2, prev_twos])
	prew_twos = 0
if prev_null != 0:
	answer.append([0, prev_null])
	prev_null = 0
if len(answer) != 0 and answer[0][0] == 0:
	print('{}'.format(answer[0][0]) * answer[0][1], end='')
print('1' * ed_count, end='')
z = len(answer)
min_in = 0
if z != 0 and answer[0][0] == 0:
	min_in += 1
for i in range(min_in, z):
	print(str(answer[i][0]) * answer[i][1], end='')


import time
from copy import deepcopy
import itertools
from bisect import bisect_left
from bisect import bisect_right
import math
from collections import deque
from collections import Counter

def read():
	return int(input())

def readmap():
	return map(int, input().split())

def readlist():
	return list(map(int, input().split()))
S = list(map(int, list(input())))
num1 = S.count(1)
for i in range(len(S)):
	if S[i] == 2:
		index = i
		break
	index = len(S)
ans = []
for i in range(len(S)):
	if i == index:
		ans += [1] * num1
	if S[i] != 1:
		ans.append(S[i])
if index == len(S):
	ans += [1] * num1
print(''.join(list(map(str, ans))))


s = input()
tmp = ''
s = s[::-1]
xx = z = it = 0
for c in s:
	if c == '2':
		tmp = tmp + '0' * z + '2'
		z = 0
	if c == '0':
		z += 1
	if c == '1':
		xx += 1
	it = it + 1
tmp = tmp + '1' * xx + '0' * z
print(tmp[::-1])


line = list(input())
count = 0
for i in range(len(line) - 1, -1, -1):
	if line[i] == '1':
		del line[i]
		count += 1
try:
	two = line.index('2')
	newline = line[:two] + ['1'] * count + line[two:]
except:
	newline = line + ['1'] * count
print(*newline, sep='')


s = input()
ans = ''.join((c for c in s if c != '1'))
i = (ans + '2').find('2')
print(ans[:i] + s.count('1') * '1' + ans[i:])


def helper(s):
	zero = s.count('0')
	one = s.count('1')
	two = s.count('2')
	if zero == 0:
		return '1' * one + '2' * two
	elif one == 0:
		return s
	elif two == 0:
		return '0' * zero + '1' * one
	else:
		l = ''
		r = ''
		f = False
		for i in s:
			if i == '1':
				continue
			if i == '2':
				f = True
			if f:
				r += i
			else:
				l += i
		return l + '1' * one + r
s = input()
print(helper(s))


s = input()
s1 = ''
c = 0
p = s.count('1')
s = s.replace('1', '')
for i in range(len(s)):
	if s[i] == '1':
		s1 += s[i]
		s = s.replace(s[i], '3', 1)
	elif s[i] == '0' and c == 0:
		s1 += '0'
		s = s.replace(s[i], '3', 1)
	else:
		c = 1
s2 = ''
s1 += '1' * p
for i in range(len(s)):
	if s[i] == '2' or s[i] == '0':
		s2 += s[i]
print(''.join(sorted(s1)) + s2)


def solve(s):
	count = 0
	c = 0
	while c < len(s):
		if s[c] == '1':
			count += 1
			del s[c]
		else:
			c += 1
	i = -1
	if '2' in s:
		i = s.index('2')
	ones = ''
	for x in range(0, count):
		ones += '1'
	ans = ''
	if i >= 0:
		ans = ''.join(s[0:i]) + ones[:] + ''.join(s[i:])
	else:
		ans = ''.join(s[:]) + ones[:]
	return ans

def main():
	s = list(input())
	ans = solve(s)
	print(ans)
main()


s = input()
c = 0
l = len(s)
for i in range(len(s)):
	if s[i] == '1':
		c += 1
s = s.replace('1', '')
s1 = ''
if len(s) == 0:
	s1 = c * '1'
	print(s1)
	exit(0)
for i in range(len(s)):
	if s[i] == '2':
		s1 = s1 + c * '1'
		s1 += s[i:]
		break
	s1 += s[i]
if len(s1) != l:
	s1 += c * '1'
print(s1)


s = input()
s = s + '2'
t = s.replace('1', '')
i = t.find('2')
print(t[:i] + '1' * s.count('1') + t[i:-1])


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial
from collections import *
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().strip('\n')

def grid(r, c):
	return [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
s = S()
ans = s.replace('1', '') + '2'
t = ans.find('2')
print(ans[:t] + '1' * s.count('1') + ans[t:len(ans) - 1])
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


s = input()
s = [int(i) for i in s]
s.reverse()
ans = [0] * len(s)
f = 0
(r0, r1) = (0, 0)
for i in s:
	if i == 2:
		while r0:
			r0 -= 1
			ans[f] = 0
			f += 1
		ans[f] = 2
		f += 1
	elif i == 1:
		r1 += 1
	else:
		r0 += 1
while r1:
	r1 -= 1
	ans[f] = 1
	f += 1
while r0:
	r0 -= 1
	ans[f] = 0
	f += 1
ans.reverse()
for i in ans:
	print(i, end='')


def main():
	s = input()
	pos = s.find('2')
	pos = len(s) if pos < 0 else pos
	print('0' * s[:pos].count('0') + '1' * s.count('1') + s[pos:].replace('1', ''))
main()


import unittest

def min_ternary_string(_input):
	output = [' '] * len(_input)
	idx_output = 0
	idx_first2 = len(_input)
	for idx_input in range(len(_input)):
		ch = _input[idx_input]
		if ch == '2':
			idx_first2 = idx_input
			break
		if ch == '0':
			output[idx_output] = ch
			idx_output += 1
	for ch in _input:
		if ch == '1':
			output[idx_output] = ch
			idx_output += 1
	for idx_input in range(idx_first2, len(_input)):
		ch = _input[idx_input]
		if ch != '1':
			output[idx_output] = ch
			idx_output += 1
	return ''.join(output)

class TestScenario(unittest.TestCase):

	def testUnitTest(self):
		self.assertEqual(min_ternary_string('100210'), '001120')
		self.assertEqual(min_ternary_string('11222121'), '11112222')
		self.assertEqual(min_ternary_string('20'), '20')
		pass
print(min_ternary_string(input()))


n = input()
k = n.count('1')
n = n.replace('1', '') + '2'
ind = n.find('2')
print(n[:ind] + '1' * k + n[ind:-1])


a = input()
ans = a.replace('1', '') + '2'
t = ans.find('2')
print(ans[:t] + '1' * a.count('1') + ans[t:-1])


s = input()
n_ones = s.count('1')
s = s.replace('1', '')
i_2 = s.find('2')
if i_2 != -1:
	print(s[:i_2] + '1' * n_ones + s[i_2:])
else:
	print(s + '1' * n_ones)


TN = 1

def solution():
	s = list(input())
	n = len(s)
	ed = 0
	ans = ''
	for i in range(n):
		if s[i] != '1':
			ans += s[i]
		else:
			ed += 1
	k = (ans + '2').index('2')
	print(ans[:k] + '1' * ed + ans[k:])
while TN != 0:
	solution()
	TN -= 1


s = input()
ones = 0
ans = ''
for i in range(len(s)):
	if s[i] == '1':
		ones += 1
	else:
		ans += s[i]
for i in range(len(ans)):
	if ans[i] == '2':
		ans = ans[:i] + '1' * ones + ans[i:]
		break
if len(ans) != len(s):
	ans += '1' * ones
print(ans)


s = input()
s = list(s)
uns = 0
for n in s:
	if n == '1':
		uns += 1
aindanao = 1
for a in s:
	if a == '2' and aindanao:
		aindanao = 0
		for i in range(uns):
			print('1', end='')
	if a != '1':
		print(a, end='')
if aindanao:
	aindanao = 0
	for i in range(uns):
		print('1', end='')
print()


def trocaElemento(ternary, biggerElemIndex, smallerElemIndex):
	temp = ternary[smallerElemIndex]
	ternary[smallerElemIndex] = ternary[biggerElemIndex]
	ternary[biggerElemIndex] = temp
	return ternary
entrada = input()
ternary = list(entrada)
i = 0
one = 0
ans = ''
while i < len(ternary):
	if ternary[i] == '0':
		ans = ans + '0'
	if ternary[i] == '1':
		one = one + 1
	if ternary[i] == '2':
		ans = ans + '2'
	i = i + 1
flag = False
i = 0
while i < len(ans):
	if ans[i] == '2' and (not flag):
		flag = True
		for x in range(one):
			print('1', end='')
	print(ans[i], end='')
	i = i + 1
if not flag:
	for x in range(one):
		print('1', end='')


l = list(input())
s = l.count('1')
ls = []
for i in range(len(l)):
	if l[i] == '1':
		ls.append(i)
ls.sort(reverse=True)
for i in range(len(ls)):
	del l[ls[i]]
set1 = set(l)
if '2' in set1:
	m = l.index('2')
	l1 = l[:m]
	l2 = l[m:]
	li = l1 + ['1'] * s + l2
	print(''.join(li))
else:
	li = l + ['1'] * s
	print(''.join(li))


s = input() + '2'
cnt1 = s.count('1')
s = s.replace('1', '')
pos = s.find('2')
print(s[:pos] + '1' * cnt1 + s[pos:-1])


import sys

def input():
	return sys.stdin.readline().strip()
s = input()
freq = {'0': 0, '1': 0}
i = 0
while i < len(s):
	if s[i] == '2':
		break
	else:
		freq[s[i]] += 1
	i += 1
suf_s = ''
while i < len(s):
	if s[i] == '1':
		freq[s[i]] += 1
	else:
		suf_s += s[i]
	i += 1
pre_s = '0' * freq['0'] + '1' * freq['1']
print(pre_s + suf_s)


s = input()
l = ''
for x in s:
	if x != '1':
		l += x
two = s.count('2')
one = s.count('1')
ans = ''
if two > 0:
	flag = 1
	for i in range(len(l)):
		if l[i] == '2' and flag == 1:
			ans += '1' * one + '2'
			flag = 0
		else:
			ans += l[i]
else:
	ans = l
	ans += '1' * one
print(ans)


import sys
input = sys.stdin.readline
read_tuple = lambda _type: map(_type, input().split(' '))

def solve():
	a = list(input().replace('\n', ''))
	delete_ones = []
	count_ones = 0
	for a_i in a:
		if a_i == '1':
			count_ones += 1
		else:
			delete_ones.append(a_i)
	ans = []
	for elem in delete_ones:
		if elem == '2' and count_ones:
			ans.append('1' * count_ones)
			count_ones = 0
		ans.append(elem)
	if count_ones:
		ans.append('1' * count_ones)
		count_ones = 0
	print(''.join(ans))
solve()


s = list(map(int, input()))
try:
	first_two = s.index(2)
	start = sorted(s[:first_two])
	end = []
	for c in s[first_two:]:
		if c == 1:
			start.append(c)
		else:
			end.append(c)
	sor = start + end
except:
	sor = sorted(s)
print(''.join(map(str, sor)))


s = input()
s = list(s)
n = len(s)
i = 0
j = i
while j < n and s[j] != '2':
	j += 1
a = sorted(s[i:j])
one = []
others = []
while j < n:
	if s[j] == '1':
		one += [s[j]]
	else:
		others += [s[j]]
	j += 1
ans = a + one + others
print(''.join(ans))


s = input()
answer = ''
zero = one = 0
finished = False
for num in s:
	if num == '0':
		if finished == False:
			zero += 1
		else:
			answer += num
	if num == '1':
		one += 1
	if num == '2':
		finished = True
		answer += num
z = ''.join(['0'] * zero)
o = ''.join(['1'] * one)
print(z + o + answer)


s = input()
answer = ''
p = 0
o = 1
for i in s:
	if i == '1':
		p = p + 1
for i in s:
	if i == '0':
		answer = answer + '0'
	elif i == '2':
		answer = answer + '1' * (o * p)
		o = 0
		answer = answer + '2'
answer = answer + '1' * (o * p)
print(answer)


from sys import stdin
line = stdin.readline().rstrip()
count0 = 0
count1 = 0
index = 0
found2 = False
for c in line:
	index += 1
	if c == '0':
		count0 += 1
	if c == '2':
		found2 = True
		break
while count0 > 0:
	count0 -= 1
	print('0', end='')
for c in line:
	if c == '1':
		print('1', end='')
if found2:
	print('2', end='')
for i in range(index, len(line)):
	if line[i] != '1':
		print(line[i], end='')


t = str(input(''))
A = []
count = 0
s = ''
check = 0
j = 0
for i in range(len(t)):
	if t[i] != '1':
		s += t[i]
	else:
		count += 1
for i in range(len(s)):
	if s[i] == '2':
		j = i
		break
else:
	j = len(s)
k = j - 1
ans = s[0:j] + '1' * count + s[j:]
print(ans)


import sys
input = sys.stdin.readline
s = input()[:-1]
one = 0
ans = []
for i in range(len(s)):
	if s[i] == '1':
		one += 1
	else:
		ans.append(s[i])
ans2 = []
for i in range(len(ans)):
	if ans[i] == '2':
		for _ in range(one):
			ans2.append('1')
		for j in range(i, len(ans)):
			ans2.append(ans[j])
		break
	else:
		ans2.append(ans[i])
else:
	for _ in range(one):
		ans2.append('1')
print(''.join(ans2))


s = input()
tmp = ''
s = s[::-1]
xx = z = it = 0
while it < len(s):
	if s[it] == '2':
		tmp = tmp + '0' * z + '2'
		z = 0
	if s[it] == '0':
		z += 1
	if s[it] == '1':
		xx += 1
	it = it + 1
tmp = tmp + '1' * xx + '0' * z
print(tmp[::-1])


s = input() + '2'
o = s.count('1')
s = s.replace('1', '')
i = s.index('2')
print(s[:i] + '1' * o + s[i:-1])


s = input()
head = ''
tail = ''
for ch in s:
	if ch == '1':
		head += ch
	elif ch == '0' and len(tail) == 0:
		head = ch + head
	else:
		tail += ch
print(head + tail)


s = [i for i in input()]
s.reverse()
ans = ''
(c0, c1) = (0, 0)
for i in s:
	if i == '2':
		ans += c0 * '0'
		ans += '2'
		c0 = 0
	elif i == '0':
		c0 += 1
	else:
		c1 += 1
ans += c1 * '1'
ans += c0 * '0'
for i in range(len(s) - 1, -1, -1):
	print(ans[i], end='')


s = input()
index = [0]
n = len(s)
zero = []
one = []
zo = 0
on = 0
for i in range(n):
	if s[i] == '2' and i != 0:
		index.append(i)
		zero.append(zo)
		one.append(on)
		zo = 0
		on = 0
	elif s[i] == '0':
		zo = zo + 1
	elif s[i] == '1':
		on = on + 1
if index[-1] != n - 1:
	index.append(n)
	zero.append(zo)
	one.append(on)
S = set(s)
ans = ''
b = len(index)
if len(S) == 1:
	ans = ans + s
elif len(S) == 2:
	if '0' in S and '1' in S:
		ans = '0' * s.count('0') + '1' * s.count('1')
	elif '1' in S and '2' in S:
		ans = '1' * s.count('1') + '2' * s.count('2')
	else:
		ans = ans + s
else:
	b = len(one)
	if s[0] != '2':
		ans = ans + '0' * s[:index[1]].count('0')
	else:
		ans = ans + '0' * s[:index[0]].count('0')
	ans = ans + '1' * s.count('1')
	p = ''
	a = s.find('2')
	for i in range(a, n):
		if s[i] != '1':
			p = p + s[i]
	ans = ans + p
print(ans)


n = input()
lenght = len(n)
if not '1' in n:
	print(n)
elif not '2' in n:
	zero = n.count('0')
	string = ''
	lenght -= zero
	while zero:
		zero -= 1
		string += '0'
	while lenght:
		lenght -= 1
		string += '1'
	print(string)
elif not '0' in n:
	zero = n.count('1')
	string = ''
	lenght -= zero
	while zero:
		zero -= 1
		string += '1'
	while lenght:
		lenght -= 1
		string += '2'
	print(string)
else:
	zero = n.count('0')
	unu = n.count('1')
	doi = n.count('2')
	partial0 = 0
	i = lenght - 1
	d = ''
	while i >= 0:
		part = 0
		if doi:
			while n[i] != '2':
				if n[i] == '0':
					part += 1
				i -= 1
			zero -= part
			while part:
				part -= 1
				d += '0'
			while i >= 0:
				if n[i] != '2':
					break
				i -= 1
				doi -= 1
				d += '2'
		else:
			break
	while unu:
		d += '1'
		unu -= 1
	while zero:
		zero -= 1
		d += '0'
	d = d[::-1]
	print(d)


inpt = input()
inp = list(str(inpt))
temp = []
for i in inp:
	temp.append(int(i))
nums = temp[::-1]
countZero = 0
countOne = 0
res = []
for i in range(len(nums)):
	if nums[i] == 0:
		countZero += 1
	elif nums[i] == 1:
		countOne += 1
	else:
		res += [0] * countZero
		res.append(2)
		countZero = 0
res += [1] * countOne
res += [0] * countZero
res = res[::-1]
res = ''.join((str(item) for item in res))
print(res)


s = list(input())
ans = ''
t = False
cnt1 = 0
f2 = -1
pc = {'0': 0, '1': 0, '2': 0}
for i in range(len(s)):
	if s[i] == '2':
		t = True
		if f2 == -1:
			f2 = i
	if not t:
		pc[s[i]] += 1
	if s[i] == '1' and t:
		cnt1 += 1
if f2 == -1:
	print('0' * pc['0'] + '1' * pc['1'])
	exit()
ans = '0' * pc['0'] + '1' * (pc['1'] + cnt1)
for i in range(f2, len(s)):
	if s[i] != '1':
		ans += s[i]
print(ans)


import sys
s = input()
cnt = 0
ans = []
for x in s:
	if x == '1':
		cnt += 1
	else:
		ans.append(x)
for i in range(len(ans)):
	if ans[i] == '2':
		break
else:
	print(''.join(ans) + '1' * cnt)
	sys.exit()
print(''.join(ans[:i]) + '1' * cnt + ''.join(ans[i:]))


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	s = input()
	temp = s.split('2')
	half = ''
	n = len(temp)
	(c1, c2, c3) = (0, 0, 0)
	loca = ''
	for x in range(n):
		if x == 0:
			half = half + '0' * temp[x].count('0') + '1' * temp[x].count('1')
		else:
			c1 += temp[x].count('1')
			loca += '2' + '0' * temp[x].count('0')
	print(half + '1' * c1 + loca)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


st = input()
kol_1 = st.count('1')
stroka = []
lena = 0
for elem in st:
	if elem != '1':
		stroka += [elem]
		lena += 1
i = 0
while i < lena and stroka[i] != '2':
	i += 1
stroka = stroka[0:i] + ['1'] * kol_1 + stroka[i:]
print(''.join(map(str, stroka)))


s = input()
a = ''
b = ''
for i in s:
	if i == '1':
		a += i
	else:
		b += i
n = b.find('2')
if n == -1:
	ans = b + a
else:
	ans = b[:n] + a + b[n:]
print(ans)


def moveTwos(lst):
	totalTwos = 0
	for (index, ele) in enumerate(lst):
		if ele == 2:
			totalTwos += 1
		if ele == 1:
			(lst[index - totalTwos], lst[index]) = (lst[index], lst[index - totalTwos])
		if ele == 0:
			totalTwos = 0
	return lst

def moveOnes(lst):
	totalOnes = 0
	for (index, ele) in enumerate(lst):
		if ele == 1:
			totalOnes += 1
		if ele == 0:
			(lst[index - totalOnes], lst[index]) = (lst[index], lst[index - totalOnes])
		if ele == 2:
			totalOnes = 0
	return lst

def moveOnesLeft(lst):
	totalOnes = 0
	for index in range(len(lst) - 1, -1, -1):
		ele = lst[index]
		if ele == 1:
			totalOnes += 1
		else:
			(lst[index + totalOnes], lst[index]) = (lst[index], lst[index + totalOnes])
	return lst

def main():
	inp = [int(i) for i in str(input())]
	ans = moveOnes(moveTwos(moveOnesLeft(inp)))
	for i in ans:
		print(i, end='')
main()


a = input()
x = len(a)
q = 0
a = a.replace('1', '')
if len(a) != 0:
	if a[0] == '2':
		print('1' * (x - len(a)) + a)
		exit(0)
	else:
		for i in range(len(a) - 1):
			print(a[i], end='')
			if a[i + 1] == '2':
				print('1' * (x - len(a)) + a[i + 1:])
				q = 1
				break
		if q == 0:
			print('0', end='')
if q == 0:
	print('1' * (x - len(a)))


s = input()
c1 = s.count('1')
if '2' not in s:
	lens = len(s)
	print('0' * (lens - c1) + '1' * c1)
else:
	f2 = s.index('2')
	s1 = s[:f2]
	s2 = ''.join((c for c in s[f2:] if c != '1'))
	c0 = s1.count('0')
	print('0' * c0 + '1' * c1 + s2)


s = input()
ans = []
cnt1 = 0
for c in s:
	if c == '1':
		cnt1 += 1
	else:
		ans += [c]
j = 0
while j < len(ans) and ans[j] == '0':
	j += 1
ans = ans[:j] + ['1'] * cnt1 + ans[j:]
print(''.join(ans))


a = input()
ones = 0
for i in a:
	if i == '1':
		ones += 1
frontZeroes = 0
for i in a:
	if i == '2':
		break
	if i == '0':
		frontZeroes += 1
b = '0' * frontZeroes + '1' * ones
if a.count('2') > 0:
	for i in range(a.index('2'), len(a)):
		if a[i] != '1':
			b += a[i]
print(b)


s = input()
oc = 0
zc = 0
id2 = len(s)
for i in range(len(s)):
	if s[i] == '1':
		oc += 1
for i in range(len(s)):
	if s[i] == '0':
		zc += 1
	if s[i] == '2':
		id2 = i
		break
for i in range(zc):
	print('0', end='')
for i in range(oc):
	print('1', end='')
for i in range(id2, len(s)):
	if s[i] == '1':
		continue
	else:
		print(s[i], end='')
print()


s = input()
count1 = s.count('1')
string02 = s.replace('1', '')
index1 = string02.find('2')
if not index1 == -1:
	answer = string02[:index1] + '1' * count1 + string02[index1:]
else:
	answer = string02 + '1' * count1
print(answer)


(s, t, k) = (input(), '', 0)
for i in s:
	if i != '1':
		t += i
	else:
		k += 1
i = t.index('2') if '2' in t else len(t)
print(t[:i] + '1' * k + t[i:])


def scanf(obj=list, type=int):
	return obj(map(type, input().split()))
s = input()[-1::-1]
ans = ''
z = on = 0
for i in range(len(s)):
	if s[i] == '0':
		z += 1
	if s[i] == '1':
		on += 1
	if s[i] == '2':
		ans += '0' * z + '2'
		z = 0
ans += '1' * on + '0' * z
print(ans[-1::-1])


s = input()
c = s.count('1')
s = s.replace('1', '')
x = s.find('2')
if x == -1:
	print(s + '1' * c)
else:
	print(s[:int(x)] + '1' * c + s[int(x):])


strng = input()
num = strng.count('1')
strng = strng.replace('1', '')
r = strng.find('2')
if r == -1:
	strng = strng + '1' * num
else:
	strng = strng[:r] + '1' * num + strng[r:]
print(strng)


t = input()
t = t + '2'
Z = []
U = 0
c = 0
for i in t:
	if i == '1':
		U += 1
	elif i == '0':
		c += 1
	else:
		Z.append(c)
		c = 0
for i in range(Z[0]):
	print('0', end='')
for i in range(U):
	print('1', end='')
for j in range(1, len(Z)):
	print('2', end='')
	for i in range(Z[j]):
		print('0', end='')


s = list(input())
one = 0
res = ''
for x in s:
	if x == '1':
		one += 1
	else:
		res += x
ans = -1
for i in range(len(res)):
	if res[i] == '2':
		ans = i
		break
new_s = '1' * one
if ans == -1:
	s = res + new_s
elif ans == 0:
	s = new_s + res
else:
	s = res[:ans] + new_s + res[ans:]
print(s)


def minString(s):
	l = list(s)
	c1 = l.count('1')
	l = [x for x in l if x != '1']
	if '2' in l:
		i = l.index('2')
		l[i:i] = ['1'] * c1
	else:
		l.extend(['1'] * c1)
	return ''.join(l)
s = str(input())
print(minString(s))


s = input()
n = len(s)
tp = ''
ans = ''
(c0, c1, c2) = (0, 0, 0)
for e in s:
	if e == '1':
		c1 = c1 + 1
	elif e == '0':
		c0 = c0 + 1
	else:
		c2 = c2 + 1
if c2 == 0:
	r = '0' * c0 + '1' * c1
	print(r)
else:
	r = ''
	z = s.index('2')
	lp = s[:z]
	qw = lp.count('0')
	p = 0
	while z < n:
		a = s[z]
		if a == '1':
			p = p + 1
			z = z + 1
		else:
			c = 0
			while z < n and s[z] == a:
				c = c + 1
				z = z + 1
			r = r + a * c
	ans = '0' * qw + '1' * c1 + r
	print(ans)


import sys
import math
import bisect

def solve(s):
	n = len(s)
	A = []
	num_one = 0
	for c in s:
		if c == '0':
			A.append(0)
		elif c == '1':
			num_one += 1
		elif c == '2':
			A.append(2)
	p = len(A)
	for i in range(len(A)):
		if A[i] == 2:
			p = i
			break
	return A[0:p] + [1] * num_one + A[p:len(A)]

def main():
	s = input()
	print(''.join(list((str(a) for a in solve(s)))))
main()


s = input()
n = len(s)
string = ''
for i in s:
	if i != '1':
		string += i
c = s.count('1')
ans = ''
j = 0
for i in string:
	if i == '2':
		break
	else:
		j += 1
		ans += i
ans += '1' * c
for i in range(j, len(string)):
	ans += string[i]
print(ans)


import re
s = input()
t = '1' * s.count('1')
s = re.sub('1', '', s)
if '2' in s:
	p = s.find('2')
	s = s[:p] + t + s[p:]
else:
	s = s + t
print(s)


s = input()
pref = []
cnt1 = s.count('1')
s = s.replace('1', '')
i = 0
while i < len(s) and s[i] != '2':
	i += 1
end = ''
if i != len(s):
	end = s[i:]
s = s[:i] + '1' * cnt1 + end
print(s)


from enum import Enum

class T(str, Enum):
	ZERO = ('0',)
	ONE = ('1',)
	TWO = '2'

def searchKey(array, key, start_pos):
	MAX_LIMIT = len(array)
	while start_pos < MAX_LIMIT:
		if array[start_pos] == key:
			return start_pos
		start_pos = start_pos + 1
	raise LookupError

def swapPositions(tern, index, fin):
	L = len(tern)
	assert index < L and fin < L
	k = tern[fin]
	for i in range(fin, index, -1):
		tern[i] = tern[i - 1]
	tern[index] = k

def solve(tern):
	L = len(tern)
	for index in range(L):
		if tern[index] == T.ZERO:
			pass
		elif tern[index] == T.ONE and index < L - 1:
			if tern[index + 1] == T.ZERO:
				tern[index] = T.ZERO
				tern[index + 1] = T.ONE
		elif tern[index] == T.TWO and index < L - 1:
			try:
				fin = searchKey(tern, key=T.ONE, start_pos=index + 1)
				swapPositions(tern, index, fin)
			except LookupError:
				pass
	return tern

def find(arr, item):
	L = len(arr)
	for x in range(L):
		if arr[x] == item:
			return x
	return L

def new_solve(arr):
	ones = len(list(filter(lambda x: x == T.ONE, arr)))
	new_arr = list(filter(lambda x: x != T.ONE, arr))
	key_pos = find(new_arr, T.TWO)
	return new_arr[:key_pos] + ['1'] * ones + new_arr[key_pos:]
tern = input()
print(''.join(new_solve(tern)))


import functools
import time

def timer(func):

	@functools.wraps(func)
	def wrapper(*args, **kwargs):
		stime = time.perf_counter()
		res = func(*args, **kwargs)
		elapsed = time.perf_counter() - stime
		print(f'{func.__name__} in {elapsed:.4f} secs')
		return res
	return wrapper

class solver:

	def __init__(self):
		pass

	def __call__(self):
		s = list(input().strip())
		n = len(s)
		res = list()
		p = n - 1
		ones = 0
		zeros = 0
		while p >= 0:
			if s[p] == '0':
				zeros += 1
			elif s[p] == '1':
				ones += 1
			elif s[p] == '2':
				res.extend(['0'] * zeros)
				res.append('2')
				zeros = 0
			p -= 1
		res.extend(['1'] * ones)
		res.extend(['0'] * zeros)
		res.reverse()
		print(''.join(map(str, res)))
solver()()


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
INF = 99999999999999999999999999999999

def outIn(x):
	print(x, flush=True)
	return input()

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		s = rs()
		d = Counter(s)
		if '1' in d:
			news = ''
			for i in s:
				if i != '1':
					news += i
			ans = ''
			ind = len(news)
			for i in range(len(news)):
				if news[i] == '2':
					ind = i
					break
			ans = news[0:ind] + '1' * d['1'] + news[ind:]
			ws(ans)
		else:
			ws(s)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


s = input()
n1 = s.count('1')
s = ''.join(list(filter(lambda c: c != '1', s)))
if '2' in s:
	s = s[:s.find('2')] + '1' * n1 + s[s.find('2'):]
else:
	s = s + '1' * n1
print(s)


s = input()
q = s.index('2') if '2' in s else len(s)
w = s.count('1')
e = s[:q].count('0')
a = '0' * e + '1' * w
for i in s[q:]:
	if i != '1':
		a += i
print(a)


s = list(input())
ss = ''
cnt = [0, 0, 0]
i = 0
cnt = 0
while i != len(s) and s[i] in ['0', '1']:
	cnt += s[i] == '0'
	i += 1
print('0' * cnt + '1' * s.count('1'), end='')
while i != len(s):
	if s[i] in ['0', '2']:
		print(s[i], end='')
	i += 1


temp = [int(x) for x in list(input())]
n = len(temp)
cnt1 = 0
cnt0 = 0
line = []
for i in temp:
	if i == 1:
		cnt1 += 1
	else:
		line.append(i)
k = len(line)
for i in range(len(line)):
	if line[i] == 2:
		k = i
		break
	cnt0 += 1
ans = [0] * cnt0 + [1] * cnt1 + line[k:]
print(''.join([str(x) for x in ans]))


s = input()
cnt = 0
v = []
for ch in s:
	if ch == '1':
		cnt += 1
	else:
		v.append(ch)
for ch in v:
	if ch == '2':
		for i in range(cnt):
			print(1, end='')
		cnt = 0
	print(ch, end='')
for i in range(cnt):
	print(1, end='')


n = list(input())
if set(n) == {1, 2} or set(n) == {0, 1}:
	n.sort()
	print(''.join(n))
else:
	count = n.count('1')
	l = ['1'] * count
	for i in range(len(n)):
		if n[i] != '1':
			l.append(n[i])
	count2 = 0
	for i in range(count, len(n)):
		if l[i] == '0':
			count2 += 1
		else:
			break
	final = ['0'] * count2 + ['1'] * count
	for i in range(count + count2, len(n)):
		final.append(l[i])
	print(''.join(final))


import copy
s = input()
count = s.count('1')
if count == 0:
	print(s)
else:
	s = s.replace('1', '')
	if s.count('2') == 0:
		print(s, end='')
		for j in range(count):
			print('1', end='')
	else:
		index = -1
		for i in range(len(s)):
			if s[i] == '2':
				for j in range(count):
					print('1', end='')
				print(s[i], end='')
				index = i + 1
				break
			else:
				print(s[i], end='')
		for i in range(index, len(s)):
			print(s[i], end='')


s = input()
n = len(s)
ans = []
cnt1 = 0
for i in range(n):
	if s[i] != '1':
		ans.append(s[i])
	else:
		cnt1 += 1
ans.append('9')
for (i, char) in enumerate(ans):
	if char != '0':
		res = ans[0:i] + ['1'] * cnt1 + ans[i:]
		break
print(''.join(map(str, res))[0:n])


u = list(map(int, input()))
n = len(u)
d0 = 0
d1 = 0
d2 = 0
dd0 = []
dd2 = []
m0 = 0
for i in range(n):
	if u[i] == 1:
		d1 += 1
	elif u[i] == 0:
		if dd2 == [] and d2 == 0:
			m0 = 1
		d0 += 1
		if d2 != 0:
			dd2.append(d2)
			d2 = 0
	else:
		d2 += 1
		if d0 != 0:
			dd0.append(d0)
			d0 = 0
if d0 != 0:
	dd0.append(d0)
else:
	dd2.append(d2)
ans = []
i = 0
while len(ans) < n:
	if m0:
		if len(dd0) > i:
			for j in range(dd0[i]):
				ans.append(0)
		if i == 0:
			for j in range(d1):
				ans.append(1)
		if len(dd2) > i:
			for j in range(dd2[i]):
				ans.append(2)
	else:
		if i == 0:
			for j in range(d1):
				ans.append(1)
		if len(dd2) > i:
			for j in range(dd2[i]):
				ans.append(2)
		if len(dd0) > i:
			for j in range(dd0[i]):
				ans.append(0)
	i += 1
for i in ans:
	print(i, end='')


from collections import deque
s = input()
if len(set(s)) == 1:
	print(s)
	exit(0)
x = s.count('1')
s = s.replace('1', '')
indx = -1
for i in range(len(s)):
	if s[i] == '2':
		indx = i
		break
if indx == -1:
	for i in range(x):
		s += '1'
	print(s)
	exit(0)
else:
	s1 = '1' * x
	s2 = ''
	s3 = ''
	for i in range(len(s)):
		if i == indx:
			break
		else:
			s2 += s[i]
	for i in range(indx, len(s)):
		s3 += s[i]
	print(s2 + s1 + s3)


def main():
	a = [int(x) for x in list(input().strip())]
	aux = [0] * 3
	ans = []
	aux[int(a[0])] = 1
	prev = 0
	temp = 0
	for i in range(len(a) - 1):
		aux[int(a[i + 1])] = 1
		if abs(a[i] - a[i + 1]) > 1 or sum(aux) > 2:
			temp = a[prev:i + 1]
			prev = i + 1
			temp.sort()
			ans += temp
			aux = [0] * 3
			aux[int(a[i + 1])] = 1
	ans += sorted(a[prev:])
	if 2 in a and 1 in a:
		st = ans.index(2)
		et = ans[st + 1:].count(1)
		ans = ans[:st] + [1] * et + [kk for kk in ans[st:] if kk != 1]
	print(''.join((str(x) for x in ans)))
main()


import math

def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def lcd(a, b):
	return a * b // gcd(a, b)

def input_int():
	return list(map(int, input().split()))

def solve():
	string = input()
	zeros = 0
	ones = 0
	first_two = -1
	leftover = ''
	for (i, char) in enumerate(string):
		if char == '1':
			ones += 1
		elif first_two == -1:
			if char == '0':
				zeros += 1
			elif char == '2':
				first_two = i
				leftover += char
		else:
			leftover += char
	res = '0' * zeros + '1' * ones + leftover
	print(res)
	return
solve()


ans = []
seen = False
ones = 0
for c in input():
	if c == '0':
		if not seen:
			print('0', end='')
		else:
			ans.append('0')
	elif c == '1':
		ones += 1
	elif c == '2':
		seen = True
		ans.append('2')
print(*['1'] * ones, sep='', end='')
print(''.join(ans), end='')


k = input()
l = list(k)
l.sort()
c = l.count('1')
s = ''
count = 0
one = 0
if c == 0:
	print(k)
else:
	for i in range(len(l)):
		if k[i] == '0':
			count += 1
		elif k[i] == '2':
			break
	one = c + 0
	maxi = count
	for i in range(len(l)):
		if l[i] == '0' and count > 0:
			s += l[i]
			count -= 1
		elif l[i] == '1' and one > 0:
			one -= 1
			s += l[i]
	for i in range(len(k)):
		if k[i] == '0' and maxi > 0:
			maxi -= 1
		elif k[i] == '0' and maxi == 0:
			s = s + k[i]
		elif k[i] == '2':
			s = s + k[i]
	print(s)


s = input()
one = s.count('1')
ans = str()
pos = -1
n = len(s)
for i in range(n):
	if s[i] == '2':
		pos = i
		break
if pos == -1:
	print(''.join(sorted(s)))
else:
	k = s[:pos]
	zero = k.count('0')
	ans = str()
	ans = '0' * zero + '1' * one + s[pos:]
	flag = False
	for i in ans:
		if flag and i == '1':
			continue
		if i == '2':
			flag = True
		print(i, end='')


s = input()
c = s.count('1')
s = s.replace('1', '')
ind = (s + '2').index('2')
if ind == -1:
	print(s + '1' * c)
else:
	print(s[:ind] + '1' * c + s[ind:])


def min_tr(s):
	c = s.count('1')
	if s[0] == '1' and s.count(s[0]) == len(s):
		return s
	if s.count('2') == 0:
		return ''.join(sorted(s))
	new = ''
	for i in range(len(s)):
		if s[i] == '0':
			new += '0'
		elif s[i] == '2':
			while c > 0:
				new += '1'
				c -= 1
			new += '2'
			while c > 0:
				new += '1'
				c -= 1
	return new
print(min_tr(input()))


def main():
	s = input()
	index = s.find('2')
	ones = 0
	if index != -1:
		for i in range(index, len(s)):
			if s[i] == '1':
				ones += 1
		l = list(s[0:index])
		l.sort()
		tmp = ''.join(l)
		for i in range(ones):
			tmp += '1'
		l = list(s[index:])
		for c in l:
			if c != '1':
				tmp += c
		print(tmp)
	else:
		l = list(s)
		l.sort()
		print(''.join(l))
main()


class Numero:

	def __init__(self, num):
		self.qtd_0 = num.count('0')
		self.qtd_1 = num.count('1')
		self.qtd_2 = num.count('2')
string = input()
num = Numero(string)
if '1' in string:
	string = string.replace('1', '')
if '2' in string:
	string = string[:string.index('2')] + '1' * num.qtd_1 + string[string.index('2'):]
else:
	string += '1' * num.qtd_1
print(string)


import math

def main():
	s = input()
	s = ' '.join(s)
	s = list(map(int, s.split()))
	(res1, res2) = ([], [])
	for i in s:
		if i == 1:
			res1.append(1)
		else:
			res2.append(i)
	(res3, res4) = ([], [])
	(count0, countR) = (0, 0)
	if len(res2) != 0:
		i = 0
		while i < len(res2) and res2[i] == 0:
			res3.append(0)
			i += 1
		if i != len(res2):
			res4 = res2[i:]
	res = res3 + res1 + res4
	print(''.join(list(map(str, res))))
main()


def min_ternary_string(seq):
	zero_two = [ch for ch in seq if ch != '1']
	ones = seq.count('1')
	i = 0
	while i < len(zero_two):
		if zero_two[i] == '2':
			break
		i += 1
	return ''.join(zero_two[:i]) + '1' * ones + ''.join(zero_two[i:])
print(min_ternary_string(input()))


s = input()
prefix = ''
suffix = ''
middle = ''
seen2 = False
for c in s:
	if c == '2':
		seen2 = True
		suffix += c
	elif c == '1':
		middle += c
	elif seen2:
		suffix += c
	else:
		prefix += c
print('%s%s%s' % (prefix, middle, suffix))


n = list(map(int, input()))
mmm = True
if len(n) > 1000:
	if n[0] == 2:
		xxx = len(n) - 1
		for i in range(1, 1000):
			if n[i] == 2 or n[i] == 0:
				mmm = False
				break
	else:
		mmm = False
else:
	mmm = False
_javob_ = []
v = 0
c = 0
hh = True
nn = True
i = 0
q = len(n) - 1
while i <= q and mmm == False:
	nn = True
	if n[i] == 1:
		v += 1
		n.pop(i)
		i -= 1
	if i < 0:
		i += 1
		nn == False
	if len(n) < 1:
		break
	if n[i] == 2:
		hh = False
	if n[i] == 0 and hh == True:
		c += 1
		n[i] = 3
	q = len(n) - 1
	if nn == False:
		i -= 1
	i += 1
i = 0
z = 0
while z != c and i <= len(n) - 1 and (mmm == False):
	if n[i] == 3:
		n.pop(i)
		i -= 1
		z += 1
	i += 1
if c > 0 and mmm == False:
	for i in range(c):
		_javob_.append(0)
if v > 0:
	for i in range(v):
		_javob_.append(1)
if mmm == False:
	_javob_ = _javob_ + n
else:
	for ll in range(xxx):
		_javob_.append(1)
	_javob_.append(2)
for j in range(len(_javob_)):
	print(_javob_[j], end='')


s = input()
b = list(s)
d = []
count_of_1 = 0
first_index_of_2 = None
for (ix, c) in enumerate(b):
	if c == '1':
		count_of_1 += 1
	else:
		d.append(c)
		if c == '2' and first_index_of_2 is None:
			first_index_of_2 = len(d) - 1
ans = d[:first_index_of_2] + ['1'] * count_of_1 + (d[first_index_of_2:] if first_index_of_2 is not None else [])
print(''.join(ans))


from collections import Counter
s = input()
l = len(s)
try:
	FirstTwo = s.index('2')
except:
	FirstTwo = l
ones = s.count('1')
FreeZeroes = s[:FirstTwo].count('0')
suffix = ''
for z in range(FirstTwo, l):
	if s[z] != '1':
		suffix += s[z]
ans = '0' * FreeZeroes + '1' * ones + suffix
print(ans)


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : list(input())
ips = lambda : input().split()
t = ip()
a = t.count('1')
ans = ''
f = 0
for i in t:
	if i == '0':
		ans += '0'
	elif i == '2':
		if f == 0:
			ans += '1' * a
			a = 0
			f = 1
		ans += i
if a > 0:
	ans += '1' * a
print(ans)


s = input()
res = ''
if s.count('2') > 0:
	res = sorted(s[:s.index('2')])
	res += ['1'] * (s.count('1') - res.count('1'))
	lim = len(res)
	res += s[s.index('2'):]
	s = ''
	for i in range(len(res)):
		if i >= lim and res[i] == '1':
			continue
		s += res[i]
	print(s)
else:
	print('0' * s.count('0') + '1' * s.count('1'))


def solve(x):
	result_string = ''
	ones_count = 0
	nulls_before = 0
	i = 0
	while i < len(x) and x[i] != '2':
		if x[i] == '1':
			ones_count += 1
		elif x[i] == '0':
			nulls_before += 1
		i += 1
	while i < len(x):
		if x[i] == '1':
			ones_count += 1
		else:
			result_string += x[i]
		i += 1
	return '0' * nulls_before + '1' * ones_count + result_string
x = input()
print(solve(x))


s = input()
len1 = s.count('1')
index2 = s.find('2')
if index2 == -1:
	index2 = len(s)
temp = s[:index2]
zero = temp.count('0')
result = '0' * zero + '1' * len1 + s[index2:].replace('1', '')
print(result)


s = input()
t = ''.join((c for c in s if c != '1'))
i = (t + '2').find('2')
print(t[:i], '1' * s.count('1'), t[i:], sep='')


a = input() + '2'
f = a.index('2')
b = a[f:]
o = ''
for i in b:
	if i != '1':
		o += i
a = a[:f]
print(a.count('0') * '0' + a.count('1') * '1' + b.count('1') * '1' + o[:-1])


s = input()
ind = 0
zeros = 0
ones = 0
while ind < len(s) and s[ind] != '2':
	if s[ind] == '0':
		zeros += 1
	else:
		ones += 1
	ind += 1
suff = ''
while ind < len(s):
	if s[ind] == '1':
		ones += 1
	else:
		suff += s[ind]
	ind += 1
print('0' * zeros + '1' * ones + suff)


s = input()
temp1 = ''
temp2 = ''
for x in s:
	if x == '0' or x == '2':
		temp1 += x
	else:
		temp2 += x
put = False
for i in range(len(temp1)):
	if temp1[i] == '2':
		temp1 = temp1[:i] + temp2 + temp1[i:]
		put = True
		break
if not put:
	temp1 = temp1 + temp2
print(temp1)


s = list(input())
if len(s) == s.count('1') or len(s) == s.count('2') or len(s) == s.count('0') or (len(s) == s.count('0') + s.count('2')):
	print(''.join(s))
elif len(s) == s.count('1') + s.count('0'):
	print('0' * s.count('0') + '1' * s.count('1'))
elif len(s) == s.count('1') + s.count('2'):
	print('1' * s.count('1') + '2' * s.count('2'))
else:
	(a, si) = (s.count('1'), [i for i in s if i != '1'])
	str = ''.join(si)
	b = str.index('2')
	str = str[:b] + '1' * a + str[b:]
	print(str)


x = input()
c = x.count('1')
x = x.replace('1', '')
z = x.find('2')
if z != -1:
	x = x[0:int(z)] + '1' * c + x[int(z):]
	print(x)
else:
	print(x + '1' * c)


s = input()
was2 = False
i = 0
am1 = 0
s1 = ''
for i in range(len(s)):
	if s[i] == '1':
		am1 += 1
for i in range(len(s)):
	if s[i] == '2':
		if not was2:
			s1 += '1' * am1 + '2'
			was2 = True
		else:
			s1 += '2'
	if s[i] == '0':
		s1 += '0'
if not was2:
	s1 += '1' * am1
print(s1)


import sys

def input():
	return sys.stdin.readline().strip()
s = input()
freq = {'0': 0, '1': 0}
i = 0
while i < len(s):
	if s[i] == '2':
		break
	else:
		freq[s[i]] += 1
	i += 1
s = list(s[i:])
suf_s = ''
for i in s:
	if i == '1':
		freq[i] += 1
	else:
		suf_s += i
pre_s = ''
for i in range(freq['0']):
	pre_s += '0'
for i in range(freq['1']):
	pre_s += '1'
print(pre_s + suf_s)


s = input()
(l, m, r) = ('', '', '')
for c in s:
	if c == '1':
		m += c
	elif c == '2':
		r += c
	elif r == '':
		l += c
	else:
		r += c
print(l + m + r)


s = input()
n = 0
m = 0
h = ''
for i in range(len(s)):
	if s[i] == '1':
		m += 1
for i in range(len(s)):
	if s[i] == '0':
		n += 1
	if s[i] == '2':
		h += '0' * n + '1' * m + '2'
		n = 0
		m = 0
h += '0' * n + '1' * m
print(h)


a = input()
ans = ''.join((ch for ch in a if ch != '1')) + '2'
t = ans.find('2')
print(ans[:t] + a.count('1') * '1' + ans[t:-1])


strArr = list(input())
pos = -1
for i in range(len(strArr)):
	pos = i
	if strArr[i] == '2':
		break
if pos == len(strArr) - 1 and strArr[pos] != '2':
	pos = len(strArr)
ans = ''
if pos != -1:
	for i in range(0, pos):
		if strArr[i] == '0':
			ans += str(strArr[i])
	for i in range(len(strArr)):
		if strArr[i] == '1':
			ans += str(strArr[i])
	for i in range(pos, len(strArr)):
		if strArr[i] != '1':
			ans += str(strArr[i])
print(ans)


s = list(map(int, list(input())))
c = [0, 0, 0]
ans = list()
f = True
for el in s:
	if el == 0 and c[2] > 0:
		ans.append('0' * c[0])
		if f:
			ans.append('1' * s.count(1))
			f = False
		ans.append('2' * c[2])
		c = [0, 0, 0]
	if el != 1:
		c[el] += 1
ans.append('0' * c[0])
ans.append('2' * c[2])
if f:
	if 0 not in s:
		ans.insert(0, '1' * s.count(1))
	elif 2 not in s:
		ans.insert(-1, '1' * s.count(1))
	else:
		ans.insert(1, '1' * s.count(1))
	f = False
print(''.join(ans))


n = list(map(str, list(input())))
a = ''
b = ''
for i in n:
	if i == '1':
		a += '1'
	else:
		b += i
n = b.find('2')
if n == -1:
	print(b + a)
else:
	print(b[:n] + a + b[n:])


a = input()
count1 = 0
result = ''
for i in a:
	if i == '1':
		count1 += 1
	else:
		result += i
index = len(result) + 1
for i in range(len(result)):
	if result[i] == '2':
		index = i + 1
		break
print(result[:index - 1] + '1' * count1 + result[index - 1:])


lis = list(input())
o = z = i = 0
ans = ''
n = len(lis)
while i < n and lis[i] != '2':
	if lis[i] == '0':
		z += 1
	else:
		o += 1
	i += 1
ans = '0' * z + '1' * o
o = z = t = 0
ans += '1' * lis[i:].count('1')
while i < n:
	while i < n and lis[i] == '2':
		t += 1
		i += 1
	while i < n and lis[i] != '2':
		if lis[i] == '0':
			z += 1
		i += 1
	ans += '2' * t + '0' * z
	t = z = 0
print(ans)


word = input()
count_ones = 0
cur_word = ''
for c in word:
	if int(c) == 1:
		count_ones += 1
	if int(c) != 1:
		cur_word = cur_word + c
res = ''
found = 0
for c in cur_word:
	if int(c) == 2 and found == 0:
		found = 1
		for i in range(count_ones):
			res += '1'
		res += '2'
	else:
		res += c
if found == 0:
	for i in range(count_ones):
		res += '1'
print(res)


line = input()
number_of_1 = line.count('1')
new_line = line.replace('1', '')
pos_of_2 = new_line.find('2')
if pos_of_2 == -1:
	print(new_line + '1' * number_of_1)
else:
	print(new_line[:pos_of_2] + '1' * number_of_1 + new_line[pos_of_2:])


from collections import Counter

def solve(string):
	pos = 0
	size = len(string)
	_01_counter = Counter()
	while pos < size:
		if string[pos] == '2':
			break
		_01_counter.update(string[pos])
		pos += 1
	print('0' * _01_counter['0'] + '1' * _01_counter['1'], end='')
	number_of_ones = 0
	for i in range(pos, size):
		if string[i] == '1':
			number_of_ones += 1
	print('1' * number_of_ones, end='')
	for i in range(pos, size):
		if string[i] != '1':
			print(string[i], end='')
	print()
solve(input())


s = input()
tot_zeroes = 0
cnt_ones = 0
cnt_two = 0
s1 = []
for i in s:
	if i == '0':
		tot_zeroes += 1
	if i == '1':
		cnt_ones += 1
	if i == '2':
		cnt_two += 1
idx = len(s) + 1
for i in range(len(s)):
	if s[i] == '2':
		idx = i
		break
for k in range(idx, len(s)):
	if s[k] != '1':
		s1.append(s[k])
cnt = 0
for j in range(i + 1, len(s)):
	if s[j] == '0':
		cnt += 1
starting_zeroes = tot_zeroes - cnt
new_s = []
for j in range(starting_zeroes):
	new_s.append('0')
for j in range(cnt_ones):
	new_s.append('1')
for j in s1:
	new_s.append(j)
for j in new_s:
	print(j, end='')


data = input()
counter_1 = data.count('1')
data = data.replace('1', '')
there_is_2 = data.find('2')
if there_is_2 == -1:
	print(data + '1' * counter_1)
else:
	print(data[:there_is_2] + '1' * counter_1 + data[there_is_2:])


n = input()
ones = 0
final_str = ''
for char in n:
	if char == '1':
		ones += 1
	else:
		final_str += char
actual_final_str = ''
for i in range(len(final_str)):
	if final_str[i] == '2':
		actual_final_str += '1' * ones + final_str[i:]
		break
	if i == len(final_str) - 1:
		actual_final_str += final_str[i] + '1' * ones
		break
	else:
		actual_final_str += final_str[i]
if len(actual_final_str) < len(n):
	actual_final_str += '1' * ones
print(actual_final_str)


a = input()
b = ''
i0 = 0
i1 = 0
i2 = 0
tmpi0 = 0
c = []
flag = False
for i in range(len(a)):
	if a[i] == '1':
		i1 += 1
	elif i0 != 0 and a[i] == '2':
		b += '0' * i0
		i0 = 0
	elif i2 != 0 and a[i] == '0':
		b += '2' * i2
		i2 = 0
	if a[i] == '2':
		i2 += 1
	if a[i] == '0':
		i0 += 1
b += '0' * i0 + '2' * i2
flag = True
for i in range(len(b)):
	if flag and b[i] == '2':
		flag = False
		print('1' * i1 + '2', end='')
		i1 = 0
	else:
		print(b[i], end='')
print('1' * i1, end='')


a = input()
b = a.count('1')
a = a.replace('1', '')
c = a.find('2')
if c == -1:
	a = a + '1' * b
else:
	a = a[:c] + '1' * b + a[c:]
print(a)


s = list(input())
ans = [[], [], []]
for c in s:
	if c == '1':
		ans[1].append('1')
	elif 0 < len(ans[2]) or c == '2':
		ans[2].append(c)
	else:
		ans[0].append(c)
print(''.join(map(lambda ls: ''.join(ls), ans)))


a = [0, 0, 0, 0]
s = input()
n = len(s)
k = n
i = n - 1
answer = []
while i >= 0:
	if s[i] == '0':
		a[0] += 1
	if s[i] == '2':
		k = i
		a[2] += 1
	if s[i] == '1':
		a[1] += 1
	i -= 1
i = 0
while i < k:
	if s[i] == '0':
		answer.append('0')
	i += 1
i = 0
while i < a[1]:
	answer.append('1')
	i += 1
i = k
while i < n:
	if s[i] != '1':
		answer.append(s[i])
	i += 1
string = ''
for a in answer:
	string += str(a)
print(string)


s = input()
n = len(s)
onec = s.count('1')
zeroc = s.count('0')
twoc = s.count('2')
karma = 0
if '2' in s:
	karma = 0
else:
	karma = 1
if karma:
	print('0' * zeroc + '1' * onec)
else:
	s = list(s)
	s = [i for i in s if i != '1']
	twoind = s.index('2')
	s = s[0:twoind] + ['1'] * onec + s[twoind:]
	print(*s, sep='')


s = input()
t = s.count('1')
s = s.replace('1', '')
z = s.find('2')
if z == -1:
	print(s + '1' * t)
else:
	print(s[:z] + '1' * t + s[z:])


t = 1
for test in range(t):
	n = list(input())
	firstZeros = 0
	onesCount = 0
	for i in n:
		if i == '1':
			onesCount += 1
	index = 0
	for i in n:
		if i == '0':
			firstZeros += 1
		elif i == '2':
			break
		index += 1
	print('0' * firstZeros, end='')
	print('1' * onesCount, end='')
	zeroCount = 0
	for i in range(index, len(n)):
		if n[i] == '2':
			print('0' * zeroCount, end='')
			print('2', end='')
			zeroCount = 0
		elif n[i] == '0':
			zeroCount += 1
	print('0' * zeroCount)


r = list(input())
s = ''
count = 0
for i in r:
	if i == '1':
		count = count + 1
	else:
		s = s + i
ans = ''
u = 0
while u < len(s):
	if s[u] == '2':
		break
	else:
		u = u + 1
ans = s[:u] + count * '1' + s[u:]
print(ans)


import sys
from array import array

def readline():
	return sys.stdin.buffer.readline().decode('utf-8')
s = list(map(int, readline().rstrip()))
prefix = []
suffix = []
zero = 0
for x in s:
	if x == 1:
		prefix.append(x)
	elif not suffix and x == 0:
		zero += 1
	else:
		suffix.append(x)
print('0' * zero + ''.join(map(str, prefix + suffix)))


s = input()
(ones, s) = (s.count('1'), s.replace('1', ''))
print(s[:s.index('2')] + '1' * ones + s[s.index('2'):] if '2' in s else s + '1' * ones)


input_ = list(map(str, input().split('2')))
result = ''
z_counter = 0
z_list = []
o_counter = 0
for st in input_:
	for s in st[:]:
		if s == '1':
			o_counter += 1
		elif s == '0':
			z_counter += 1
	z_list.append(z_counter)
	z_counter = 0
for (i, z) in enumerate(z_list):
	result += '0' * z
	if i == 0:
		result += '1' * o_counter
	if i == len(z_list) - 1:
		break
	result += '2'
print(result)


def main():
	string = input()
	chars = []
	cnt = 0
	for c in string:
		if c != '1':
			chars.append(c)
		else:
			cnt += 1
	res = ''.join(chars)
	if '2' in string:
		print(res[:res.find('2')] + '1' * cnt + res[res.find('2'):])
	else:
		print(res + '1' * cnt)
main()


s = input()
t = ''.join((c for c in s if c != '1'))
i = (t + '2').find('2')
print(t[:i] + '1' * (len(s) - len(t)) + t[i:])


s = input()
cnt = s.count('1')
s = s.replace('1', '')
if '2' in s:
	ind = s.index('2')
	print(s[:ind] + '1' * cnt + s[ind:])
else:
	print(s + '1' * cnt)


from sys import stdin, stdout

def rint():
	return map(int, stdin.readline().split())
s = input()
cnt = 0
for i in range(len(s)):
	if s[i] == '1':
		cnt += 1
ans = ''
found = False
for i in range(len(s)):
	if s[i] == '0':
		ans += '0'
		continue
	if s[i] == '1':
		pass
	if s[i] == '2':
		if found == False:
			ans += '1' * cnt
			found = True
		ans += '2'
if found == False:
	ans += '1' * cnt
print(ans)


from collections import Counter
s = input()
ones = Counter(s)['1']
s = s.replace('1', '')
index = 0
for i in range(len(s)):
	if s[i] != '0':
		break
	else:
		index = i + 1
f = s[0:index]
for i in range(ones):
	f += '1'
f += s[index:]
print(f)


ch = input()
p = ch.find('2')
if p == -1:
	p = len(ch)
a = ch[0:p].count('0')
b = ch.count('1')
st = '0' * a + '1' * b + ch[p:].replace('1', '')
print(st)


a = list(input())
n = len(a)
if '2' not in a or '0' not in a:
	print(''.join(sorted(a)))
else:
	ind = a.index('2')
	i = n - 1
	ans = []
	count = 0
	while i >= ind:
		if a[i] != '1':
			ans.append(a[i])
		else:
			count += 1
		i -= 1
	ans = sorted(a[:i + 1] + ['1'] * count) + ans[::-1]
	print(''.join(ans))


s = input()
p = ''
(c0, c1) = (0, 0)
for i in range(len(s)):
	if s[i] == '0':
		c0 += 1
	if s[i] == '1':
		c1 += 1
	if s[i] == '2':
		p += '0' * c0 + '1' * c1 + '2'
		(c0, c1) = (0, 0)
p += '0' * c0 + '1' * c1
if p.find('2') == -1:
	print(p)
else:
	c1 = 0
	s2 = ''
	for i in range(p.find('2'), len(s)):
		if p[i] == '2':
			s2 += '2'
		if p[i] == '0':
			s2 += '0'
		if p[i] == '1':
			c1 += 1
	ans = p[0:p.find('2')] + '1' * c1 + s2
	print(ans)


import sys, math, queue
MOD = 998244353
sys.setrecursionlimit(1000000)
s = list(input())
a = []
p = False
for i in range(len(s)):
	if s[i] == '1':
		continue
	if s[i] == '2' and (not p):
		p = True
		a.append('1' * s.count('1'))
	a.append(s[i])
if not p:
	a = a + ['1' * s.count('1')]
print(''.join(a))


s = input()
len1 = s.count('1')
index2 = s.find('2')
if index2 == -1:
	s = list(s)
	s.sort()
	print(''.join(s))
else:
	temp = s[:index2]
	zero = temp.count('0')
	result = '0' * zero + '1' * len1 + s[index2:].replace('1', '')
	print(result)


def main():
	ss = []
	s = input()
	last = ''
	_0s = 0
	_1s = 0
	_2s = 0
	for c in reversed(s):
		if c == '0':
			ss.append('2' * _2s)
			_2s = 0
			_0s += 1
		elif c == '1':
			_1s += 1
		else:
			ss.append('0' * _0s)
			_0s = 0
			_2s += 1
	ss.append('0' * _0s + '1' * _1s + '2' * _2s)
	print(''.join(reversed(ss)))
main()


n = list(input())
if '2' in n:
	k = n.index('2')
	new = ''.join(n[k:])
	grew = ''.join(n[:k])
	eazy = grew.count('0') * '0' + grew.count('1') * '1'
	hard = new.count('1') * '1'
	for el in new:
		if el != '1':
			hard += el
	print(eazy + hard)
else:
	grew = ''.join(n)
	eazy = grew.count('0') * '0' + grew.count('1') * '1'
	print(eazy)


s = str(input())
s1 = ''
j = 0
k = 0
i = 0
l = 0
flag1 = 0
while i < len(s):
	if s[i] == '2':
		break
	if s[i] == '0':
		j += 1
	elif s[i] == '1':
		k += 1
	i += 1
s1 += '0' * j + '1' * k
j = 0
k = 0
z1 = i
while i < len(s):
	if s[i] == '2':
		s1 += '2'
	elif s[i] == '0':
		s1 += '0'
	else:
		k += 1
	i += 1
s1 = s1[:z1] + k * '1' + s1[z1:]
print(s1)


s = input()
x = s.count('1')
s = s.replace('1', '')
s = '1' * x + s
u = 0
z = 0
l = 0
ans = ''
for i in range(len(s)):
	if s[i] == '2':
		ans += '0' * z + '1' * u + '2'
		z = 0
		u = 0
	elif s[i] == '1':
		u += 1
	elif s[i] == '0':
		z += 1
ans += '0' * z + '1' * u
print(ans)


s = input()
num0 = []
cnt0 = 0
num1 = 0
for i in range(len(s)):
	if s[i] == '0':
		cnt0 += 1
	elif s[i] == '1':
		num1 += 1
	else:
		num0.append(cnt0)
		cnt0 = 0
num0.append(cnt0)
print('0' * num0[0], end='')
print('1' * num1, end='')
for i in num0[1:]:
	print('2', end='')
	print('0' * i, end='')


m = input()
m = list(m)
output = []
for i in range(len(m)):
	if m[i] == '2':
		break
	if m[i] == '0':
		output.append('0')
		m[i] = 'X'
for i in range(len(m)):
	if m[i] == '1':
		output.append('1')
		m[i] = 'X'
for i in range(len(m)):
	if m[i] == '0':
		break
	if m[i] == '2':
		output.append('2')
		m[i] = 'X'
m = list(filter('X'.__ne__, m))
print(''.join(output + m))


s = input()
try:
	first = s.index('2')
	final = list(s[:first])
	final.sort()
	final = ''.join(final)
	extra = ''
	for j in range(first, len(s)):
		if s[j] in ['2', '0']:
			extra += s[j]
		else:
			final += '1'
	print(final + extra)
except:
	l = list(s[:])
	l.sort()
	print(''.join(l))


def swap(ls, index1, index2):
	aux = ls[index1]
	ls[index1] = ls[index2]
	ls[index2] = aux
	return

def main():
	ori = input()
	if ori == '' or len(ori) > 100000:
		return
	ori = list(ori)
	n = len(ori)
	i = 0
	while i != n:
		if ori[i] == '2':
			break
		i += 1
	bl = []
	al = []
	cl = []
	for j in range(i):
		if ori[j] == '0':
			al.append('0')
		elif ori[j] == '1':
			bl.append('1')
	for j in range(i, n):
		if ori[j] == '1':
			bl.append('1')
		else:
			cl.append(ori[j])
	for i in range(len(al)):
		print(al[i], end='')
	for i in range(len(bl)):
		print(bl[i], end='')
	for i in range(len(cl)):
		print(cl[i], end='')
	print()
	return
main()


import sys
import bisect
from collections import Counter
read_int = lambda : int(sys.stdin.readline())
read_ints = lambda : map(int, sys.stdin.readline().split())
read_int_list = lambda : list(read_ints())
read = lambda : sys.stdin.readline().strip()
read_list = lambda : sys.stdin.readline().split()

def main():
	s = read()
	one = s.count('1')
	s = s.replace('1', '')
	ind = s.index('2') if '2' in s else len(s)
	print(s[:ind] + '1' * one + s[ind:])
main()


s = input()
cnt = 0
s1 = s2 = s3 = ''
flag = 0
for i in s:
	if flag:
		if i == '1':
			cnt = cnt + 1
		else:
			s3 = s3 + i
	elif i == '0':
		s1 = s1 + i
	elif i == '1':
		cnt = cnt + 1
	else:
		s3 = i
		flag = 1
for i in range(cnt):
	s2 = s2 + '1'
print(s1 + s2 + s3)


s = input()
a = []
cnt = 0
for x in s:
	if x == '1':
		cnt += 1
	else:
		a.append(x)
i = 0
while i < len(a) and a[i] == '0':
	i += 1
print('0' * i + '1' * cnt + ''.join(a[i:]))


import sys
import math

class Reader:

	def __init__(self):
		self.data = ''.join(sys.stdin.readlines()).split()
		self.idp = 0

	def get(self, t):
		value = t(self.data[self.idp])
		self.idp += 1
		return value

	def list(self, t, k):
		value = map(t, self.data[self.idp:self.idp + k])
		self.idp += k
		return list(value)
r = Reader()
s = list(r.get(str))
i = 0
n = len(s)
tl = []
z = 0
d = 0
for c in s:
	if c == '1':
		d += 1
	elif c == '2':
		tl.append(0)
	elif tl:
		tl[-1] += 1
	else:
		z += 1
r = '0' * z + '1' * d
for k in tl:
	r += '2'
	r += '0' * k
print(r)


s = input()
n = len(s)
(_0, _1, i) = (0, 0, 0)
while i < n and s[i] != '2':
	if s[i] == '0':
		_0 += 1
	elif s[i] == '1':
		_1 += 1
	i += 1
front = '0' * _0 + '1' * _1
end = ''
for c in s[i:]:
	if c == '1':
		front += c
	else:
		end += c
print(front + end)


s = input()
x = ''
c = 0
for i in s:
	if i != '1':
		x += i
	else:
		c += 1
if len(x) == len(s):
	print(s)
else:
	z = x.find('2')
	if z != -1:
		for i in range(z):
			print(x[i], end='')
		print('1' * c + x[z:])
	else:
		print(x + '1' * c)


n = list(input())

def sw(w):
	ones = w.count('1')
	a = list(filter(lambda x: x != '1', w))
	if '2' in a:
		i = a.index('2')
		print(''.join(a[:i]) + '1' * ones + ''.join(a[i:]))
	else:
		print(''.join(a) + '1' * ones)
sw(n)


st = input()
ans = ''
zero = one = 0
f = True
for i in st:
	if i == '0':
		if f:
			zero += 1
		else:
			ans += i
	if i == '1':
		one += 1
	if i == '2':
		f = False
		ans += i
print(''.join(['0'] * zero) + ''.join(['1'] * one) + ans)


s = input()
m = s.count('1')
lis = []
for i in s:
	if i == '1':
		continue
	lis.append(i)
ans = ''.join(lis)
k = ans.find('2')
if k == -1:
	k = len(ans)
print(ans[:k] + '1' * m + ans[k:])


a = list(input())
a = [int(i) for i in a]
l = len(a)
i = 0
c = []
prev = 0
flag = False
b = []
fin = []
for i in a:
	if i is 1 or (flag is False and i is 0):
		fin.append(i)
	if i is 2:
		flag = True
		b.append(i)
	if flag and i is 0:
		b.append(i)
fin.sort()
print(''.join([str(i) for i in fin]) + ''.join([str(i) for i in b]))


s = list(input())
for i in range(len(s)):
	s[i] = int(s[i])
n = len(s)
ans = [i for i in s if i == 0 or i == 2]
c1 = sum([1 for i in s if i == 1])
f2 = n
for i in range(len(ans)):
	if ans[i] == 2:
		f2 = i
		break
ans1 = ans[:f2] + [1 for i in range(c1)] + ans[f2:]
print(''.join([str(i) for i in ans1]))


s = input()
a = s.count('1')
l = []
for i in s:
	if i != '1':
		l.append(i)
b = ['1'] * a
c = len(l)
for i in range(len(l)):
	if l[i] == '2':
		c = i
		break
ans = l[0:c] + b + l[c:len(l)]
for i in ans:
	print(str(i), end='')


n = input()
t = n.count('1')
n = n.replace('1', '')
if '2' in n:
	r = n.index('2')
	print('0' * r + '1' * t + n[r:])
else:
	print('0' * n.count('0') + '1' * t)


s = input()
ans = ''
cnt = 0
for char in s:
	if char == '1':
		cnt += 1
	else:
		ans += char
pos = 0
while pos < len(ans) and ans[pos] == '0':
	pos += 1
res = ans[:pos] + '1' * cnt + ans[pos:]
print(res)


def writeRestOfString(TS, result, indexOfFirstTwo):
	size = len(TS)
	for num in TS[indexOfFirstTwo:size]:
		result += str(num)
	return result

def removeAllOnesAfterFirstTwo(TS, indexOfFirstTwo):
	i = indexOfFirstTwo
	size = len(TS)
	beginOfTS = TS[0:indexOfFirstTwo]
	restOfTS = ''
	while i < size:
		if TS[i] != '1':
			restOfTS += str(TS[i])
		i += 1
	return beginOfTS + restOfTS

def countZerosAndOnes(TS, limit):
	i = 0
	zeros = 0
	ones = 0
	while i < limit:
		if TS[i] == 1:
			ones += 1
		else:
			zeros += 1
		i += 1
	return (zeros, ones)

def countOnes(TS, limit):
	i = 0
	ones = 0
	while i < limit:
		if TS[i] == 1:
			ones += 1
		i += 1
	return ones

def countZeros(TS, limit):
	i = 0
	zeros = 0
	while i < limit:
		if TS[i] == 0:
			zeros += 1
		i += 1
	return zeros

def writeZeros(result, zeros):
	i = 1
	while i <= zeros:
		result += str(0)
		i += 1
	return result

def writeOnes(result, ones):
	i = 1
	while i <= ones:
		result += str(1)
		i += 1
	return result

def checkForFirstTwo(TS):
	i = 0
	size = len(TS)
	while i < size:
		if TS[i] == 2 or TS[i] == '2':
			return i
		i += 1
	return None

def changeStringWithOnlyOnesAndZeros(TS):
	size = len(TS)
	result = ''
	(zeros, ones) = countZerosAndOnes(TS, size)
	result = writeZeros(result, zeros)
	result = writeOnes(result, ones)
	return result

def changeString(TS, indexOfFirstTwo):
	result = ''
	size = len(TS)
	zeros = countZeros(TS, indexOfFirstTwo)
	ones = countOnes(TS, size)
	result = writeZeros(result, zeros)
	result = writeOnes(result, ones)
	result = writeRestOfString(TS, result, indexOfFirstTwo)
	indexOfFirstTwo = checkForFirstTwo(result)
	result = removeAllOnesAfterFirstTwo(result, indexOfFirstTwo)
	return result

def splitString(string):
	characters = []
	size = len(string)
	i = 0
	while i < size:
		characters.append(int(string[i]))
		i += 1
	return characters
ternaryString = input()
TSArray = splitString(ternaryString)
indexOfFirstTwo = checkForFirstTwo(TSArray)
if indexOfFirstTwo != None:
	print(changeString(TSArray, indexOfFirstTwo))
else:
	print(changeStringWithOnlyOnesAndZeros(TSArray))


s = input()
oneCnt = s.count('1')
sNo1s = s.replace('1', '')
oneStr = '1' * oneCnt
first2 = sNo1s.find('2')
if first2 < 0:
	print(sNo1s + oneStr)
else:
	print(sNo1s[:first2] + oneStr + sNo1s[first2:])


s = input()
ones = s.count('1')
s = s.replace('1', '')
ind = s.find('2')
if ind == -1:
	print(s + '1' * ones)
else:
	print(s[:ind] + '1' * ones + s[ind:])


s = list(input())
data = []
n = len(s)
for i in range(n):
	s[i] = int(s[i])
cnt = 0
for some in s:
	if some == 1:
		cnt += 1
	else:
		data.append(some)
index = -1
for i in range(len(data)):
	if data[i] == 2:
		index = i
		break
if index >= 0:
	k = data[:index] + [1 for _ in range(cnt)] + data[index:]
	for i in range(n):
		k[i] = str(k[i])
	print(''.join(k))
else:
	k = data + [1 for _ in range(cnt)]
	for i in range(n):
		k[i] = str(k[i])
	print(''.join(k))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	s = string()
	ans = s.replace('1', '') + '2'
	t = ans.find('2')
	print(ans[:t] + '1' * s.count('1') + ans[t:-1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(1):
	solve()


s = input()
(o, z, fpB, fp, sp) = ('', 0, True, '', '')
for x in s:
	if fpB:
		if x == '0':
			fp += '0'
		elif x == '1':
			o += '1'
		else:
			sp += '2'
			fpB = False
	elif x != '1':
		sp += x
	else:
		o += '1'
print(fp + o + sp)


s = list(input())
a = []
k1 = 0
for i in range(len(s)):
	if s[i] == '1':
		k1 += 1
	else:
		a.append(s[i])
f = True
i = 0
a.append('a')
while i <= len(a):
	if i == len(a) - 1 and f or (a[i] == '2' and f):
		f = False
		for j in range(k1):
			print(1, end='')
	if i == len(a) - 1:
		break
	print(a[i], end='')
	i += 1


a = input()
n = len(a)
s_zero = [0] * (n + 2)
if a[0] == '0':
	s_zero[0] = 1
ans = ''
a += '2'
for i in range(1, n + 1):
	if a[i] == '0':
		s_zero[i] = s_zero[i - 1] + 1
	else:
		s_zero[i] = s_zero[i - 1]
pre = -1
two = 0
one = 0
zero = 0
for i in range(n + 1):
	if a[i] == '2':
		if pre == -1:
			pre = i
		else:
			cnt = s_zero[i] - s_zero[pre - 1]
			ans += '2' + '0' * cnt
			zero += cnt
			two += 1
		pre = i
zero = a.count('0') - zero
one = a.count('1') - one
ans = '0' * zero + '1' * one + ans
print(ans)


s = input()
c0 = c1 = 0
d0 = []
for c in s:
	if c == '0':
		c0 += 1
	elif c == '1':
		c1 += 1
	else:
		d0.append(c0)
		c0 = 0
d0.append(c0)
res = []
for i in range(len(d0)):
	for j in range(d0[i]):
		res.append('0')
	if i == 0:
		for j in range(c1):
			res.append('1')
	if i < len(d0) - 1:
		res.append('2')
print(''.join(res))


s = input()
if len(set(s)) == 1:
	print(s)
else:
	noOnes = ''
	oneCount = 0
	for i in range(len(s)):
		if s[i] == '1':
			oneCount += 1
		else:
			noOnes += s[i]
	for i in range(len(noOnes)):
		if noOnes[i] == '2':
			noOnes = noOnes[:i] + '1' * oneCount + noOnes[i:]
			break
		if i == len(noOnes) - 1:
			noOnes = noOnes + '1' * oneCount
	print(noOnes)


s = input()
one = len(list(filter(lambda x: x == '1', s)))
for elem in s:
	if elem == '2':
		if one != 0:
			print(one * '1', end='')
			one = 0
		print(elem, end='')
	if elem == '0':
		print(elem, end='')
if one != 0:
	print(one * '1')


def countc(s, c):
	k = 0
	for x in s:
		if x == c:
			k += 1
	return k
s = input()
n = len(s)
k = countc(s, '1')
if '0' not in s:
	s1 = '1' * k + '2' * (n - k)
elif '2' not in s:
	s1 = '0' * (n - k) + '1' * k
else:
	c = 0
	for i in range(n):
		if s[i] == '0':
			c += 1
		elif s[i] == '2':
			break
	s1 = '0' * c + '1' * k
	for j in range(i, n):
		if s[j] != '1':
			s1 += s[j]
print(s1)


import math
import itertools
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
a = list(input())
i = len(a) - 1
l = 0
o = 0
end_i = 0
i2 = 0
for av in a:
	i2 += 1
	if av == '2':
		break
b = a[:i2]
b = sorted(b) + a[i2:]
a = b[:]
for av in a:
	if av == '0':
		end_i += 1
	else:
		break
b = a[0:end_i]
c = []
d = []
for av in range(end_i, len(a)):
	if a[av] == '1':
		c.append(a[av])
	else:
		d.append(a[av])
print(''.join(b + c + d))


strNum = input()
ones = strNum.count('1')
strNum = strNum.replace('1', '')
first2 = (strNum + '2').find('2')
strNum = strNum[:first2] + '1' * ones + strNum[first2:]
print(strNum)


def solve(s):
	ones = s.count('1')
	stripped = ''.join([i for i in s if i != '1'])
	for i in range(len(stripped)):
		if stripped[i] == '2':
			return stripped[:i] + '1' * ones + stripped[i:]
	return stripped + '1' * ones
s = input().strip()
print(solve(s))


s = input()
n = len(s)
ans = ''
flag = 0
for i in range(n):
	if s[i] == '1':
		ans += '1'
for i in range(n):
	if s[i] == '1':
		continue
	elif s[i] == '2':
		ans += '2'
		flag = 1
	elif flag == 0:
		ans = '0' + ans
	else:
		ans += '0'
print(ans)


instr = input()
one_count = 0
first_2 = -1
pref2 = ''
postf2 = ''
for i in range(len(instr)):
	if instr[i] == '0':
		pref2 += '0'
	elif instr[i] == '1':
		one_count += 1
	else:
		first_2 = i
		break
if first_2 != -1:
	for i in range(first_2 + 1, len(instr)):
		if instr[i] == '0':
			postf2 += '0'
		elif instr[i] == '1':
			one_count += 1
		else:
			postf2 += '2'
if first_2 != -1:
	outstr = pref2 + '1' * one_count + '2' + postf2
else:
	outstr = pref2 + '1' * one_count
print(outstr)


s = input()
n = len(s)
a = 0
b = 0
for i in range(n):
	if s[i] == '1':
		b += 1
st = 0
res = ''
for i in range(n):
	if s[i] == '2':
		for i in range(a):
			res += '0'
		for i in range(b):
			res += '1'
		res += '2'
		a = 0
		b = 0
	elif s[i] == '0':
		a += 1
for i in range(a):
	res += '0'
for i in range(b):
	res += '1'
print(res)


s = input()
temp = None
paste = None
(zero, one) = (0, 0)
for i in range(len(s)):
	if s[i] == '2':
		temp = s[i:]
		break
	elif s[i] == '1':
		one += 1
	elif s[i] == '0':
		zero += 1
if temp is not None:
	for x in temp:
		if x == '1':
			one += 1
	paste = temp.replace('1', '')
ans = '0' * zero + '1' * one
if paste is not None:
	ans += paste
print(ans)


a = input()
b = len(a)
x = a.count('1')
y = ''
for i in range(b):
	if a[i] != '1':
		y += a[i]
if '2' in a:
	print(y[:y.index('2')] + '1' * x + y[y.index('2'):])
else:
	print(''.join(sorted(list(y))) + '1' * x)


s = input().strip()
if '2' not in s:
	print(''.join(sorted(s)))
	exit()
z = s.index('2')
an = []
an.append(''.join(sorted(s[:z])))
xx = s[z:].count('1')
an.append('1' * xx)
for i in range(z, len(s)):
	if s[i] != '1':
		an.append(s[i])
print(''.join(an))


s = input()
ones = 0
o = []
first_two = -1
for (i, x) in enumerate(s):
	if x == '0':
		o.append(x)
	elif x == '1':
		ones += 1
	else:
		if first_two == -1:
			first_two = len(o)
		o.append(x)
if first_two == -1:
	first_two = len(o)
one_str = '1' * ones
print(''.join(o[:first_two]) + one_str + ''.join(o[first_two:]))


s = input()
z = ''
t = ''
o = ''
f = 0
for i in range(len(s)):
	if s[i] == '0':
		t += '0'
	elif s[i] == '2':
		t += '2'
	else:
		o += '1'
for i in range(len(t)):
	if t[i] == '2':
		t = t[:i] + o + t[i:]
		f = 1
		break
if f == 0:
	t = t + o
print(t)


k = input()
a = k.count('1')
k = k.replace('1', '')
b = (k + '2').find('2')
k = k[:b] + '1' * a + k[b:]
print(k)


l = list(input()) + ['2']
i = 0
l = sorted(l[:l.index('2')]) + l[l.index('2'):]
ones = l.count('1')
zeros = l[:l.index('2')].count('0')
s = ['0'] * zeros + ['1'] * ones + list(''.join(l[l.index('2'):]).replace('1', ''))
print(''.join(s[:-1]))


def max_arr(a):
	arr = deque(a.copy())
	arr.appendleft('0')
	for i in range(1, len(arr)):
		arr[i] = max(arr[i], arr[i - 1])
	return arr
from collections import deque
s = list(input())
(a, d1, d2) = (max_arr(s), deque([]), deque([]))
for i in range(len(s)):
	if s[i] == '1':
		d1.append(s[i])
	elif s[i] == '2':
		d2.append(s[i])
	elif a[i + 1] == '2':
		d2.append(s[i])
	else:
		d1.appendleft(s[i])
d1.extend(d2)
print(''.join(d1))


a = input()
b = a.count('1')
c = 0
j = len(a)
for i in range(len(a)):
	if a[i] == '0':
		c = c + 1
	if a[i] == '2':
		j = i
		break
d = []
for i in range(j, len(a)):
	if a[i] != '1':
		d.append(a[i])
print('0' * c + '1' * b + ''.join(d))


from sys import stdin
line = stdin.readline().rstrip()
string1 = '1' * line.count('1')
line = line.replace('1', '')
pos = line.find('2')
if pos == -1:
	print(line + string1)
else:
	print(line[:pos] + string1 + line[pos:])


s = input()
a = ''.join([i for i in s if i in ['0', '2']])
b = '1' * s.count('1')
print(a[:a.find('2')] + b + a[a.find('2'):] if '2' in s else a + b)


import os
import sys

def get_string():
	return sys.stdin.readline().strip()
n = get_string()
f = 0
one = n.count('1')
temp = ''
for i in range(one):
	temp += '1'
s = ''
for i in n:
	if i == '0' or i == '2':
		s += i
if '2' in s:
	f = 1
if f == 1:
	i = s.index('2')
	ans = s[:i] + temp + s[i:]
else:
	ans = s + temp
sys.stdout.write(ans)


s = list(str(input()))
s = [int(i) for i in s]
X = []
temp = []
for i in s:
	if i != 2:
		temp.append(i)
	else:
		X.append(temp)
		temp = []
else:
	X.append(temp)
ans = [[] for i in range(len(X))]
for (j, x) in enumerate(X):
	for i in x:
		if i == 1:
			ans[0].append(1)
		else:
			ans[j].append(0)
for (i, x) in enumerate(ans):
	if x:
		x = list(sorted(x))
		x = [str(j) for j in x]
		ans[i] = ''.join(x)
	else:
		ans[i] = ''
ans = '2'.join(ans)
print(ans)


n = input()
ans = n.replace('1', '') + '2'
t = ans.find('2')
print(ans[:t] + '1' * n.count('1') + ans[t:-1])


s = list(input())
s.append('2')
l = []
c = s.count('1')
f = 0
for i in range(len(s)):
	if s[i] == '2' and f == 0:
		for j in range(c):
			l.append('1')
		f = 1
		l.append('2')
	elif s[i] != '1':
		l.append(s[i])
l = l[:len(s) - 1]
print(''.join(l))


s = input()
m = len(s)
if '2' in s:
	index = s.find('2')
	s = ''.join(list(sorted(list(s[:index])))) + s[index:].replace('1', '').rjust(m - index, '1')
else:
	s = ''.join(list(sorted(list(s))))
print(s)


s = input()
ones = s.count('1')
s = s.replace('1', '')
f2 = s.find('2')
if f2 != -1:
	s = s[:f2] + '1' * ones + s[f2:]
else:
	s += '1' * ones
print(s)


def main():
	s = input()
	zerotwo = ''.join([c for c in s if c != '1'])
	ones = '1' * (len(s) - len(zerotwo))
	i = 0
	while i < len(zerotwo) and zerotwo[i] == '0':
		i += 1
	print(zerotwo[0:i] + ones + zerotwo[i:])
main()


t = input()
n = len(t)
count0 = 0
count1 = 0
count2 = 0
(flag, i) = (0, 0)
for i in range(n):
	if t[i] == '1':
		count1 += 1
for i in range(n):
	if t[i] == '0':
		count0 += 1
	if t[i] == '2':
		flag = 1
		break
for j in range(count0):
	print('0', end='')
for j in range(count1):
	print('1', end='')
if flag == 1:
	for k in range(i, n):
		if t[k] == '2':
			print(t[k], end='')
		if t[k] == '0':
			print(t[k], end='')
		k += 1


s = input('')
num = 0
flag = False
for numero in s:
	if numero == '1':
		num += 1
if '2' not in s or '0' not in s:
	s = ''.join(sorted(s))
	print(s)
	quit()
for elemento in s:
	if elemento == '0':
		print('0', end='')
	elif elemento == '2' and (not flag == True):
		for i in range(num):
			print('1', end='')
			flag = True
		print('2', end='')
	else:
		if elemento == '1':
			continue
		if elemento == '2':
			print('2', end='')
print('')


s = input()
count_ones = 0
for c in s:
	if c == '1':
		count_ones += 1
s = s.replace('1', '')
index = s.find('2')
if index == -1:
	index = len(s)
ones = '1' * count_ones
new_string = s[:index] + ones + s[index:]
print(new_string)


s = input()
t = ''
c = 0
for x in s:
	if x != '1':
		t += x
	else:
		c += 1
i = 0
for x in t:
	if x == '0':
		i += 1
		continue
	else:
		break
t = t[:i] + c * '1' + t[i:]
print(t)


n = input()
n = list(n)
check_zero = True
check_two = True
sub = ['', '', '']
for c in range(len(n)):
	if n[c] == '0':
		check_two = False
		if check_zero:
			n[c] = 'X'
			sub[0] = sub[0] + '0'
	elif n[c] == '1':
		n[c] = 'X'
		sub[1] = sub[1] + '1'
	elif n[c] == '2':
		check_zero = False
		if check_two:
			n[c] = 'X'
			sub[2] = sub[2] + '2'
output = ''.join([i for i in sub]) + ''.join([j for j in n if j != 'X'])
print(output)


from sys import exit
s = input()
q = [-1 for i in range(len(s))]
ans = []
q = -1
for i in range(len(s)):
	if s[i] != '1':
		ans.append(s[i])
for i in range(len(ans)):
	if ans[i] == '2':
		q = i
		break
ind = q
if ind == -1:
	ind = len(ans)
for i in range(ind):
	print(ans[i], end='')
print(s.count('1') * '1', end='')
for i in range(ind, len(ans)):
	print(ans[i], end='')


s = str(input())
k = min([i for i in range(len(s)) if s[i] == '2'] + [len(s)])
z = len([c for c in s[:k] if c == '0'])
n = len([c for c in s if c == '1'])
print('0' * z + '1' * n + ''.join((c for c in s[k:] if c != '1')))


a = input()
if '2' in a:
	b = a.split('2')
	one = a.count('1')
	ze = a.count('0')
	k = ''
	for i in b[1:]:
		k += '2'
		l = i.count('0')
		k += '0' * l
		ze -= l
	print('0' * ze + '1' * one + k)
else:
	print(''.join(sorted(a)))


num = input()
length = len(num)
first_2 = num.find('2')
if first_2 == -1:
	first_2 = length
zeros_before_first_two = num[:first_2].count('0')
ones = num.count('1')
print('0' * zeros_before_first_two, end='')
print('1' * ones, end='')
for i in range(first_2, length):
	if num[i] != '1':
		print(num[i], end='')


s = input()
t = ''
num = 0
for i in range(len(s)):
	if s[i] == '1':
		num += 1
	else:
		t += s[i]
s = num * '1' + t
p = s.split('0')
q = []
for k in p:
	q.append(''.join(sorted(list(k))))
p = '0'.join(q)
p = p.split('2')
q = []
for k in p:
	q.append(''.join(sorted(list(k))))
p = '2'.join(q)
print(p)


x = input()
x = x[::-1]
y = ['0'] * len(x)
ji = 0
ji1 = 0
flag = 0
for i in range(len(x)):
	if x[i] == '1':
		ji1 += 1
	if x[i] == '2':
		flag = 1
		ji = max(ji, i - ji1)
		y[ji] = '2'
if flag:
	y = y[::-1]
	for i in range(len(y)):
		if y[i] == '2':
			for j in range(ji1):
				y[i - j - 1] = '1'
			break
else:
	for i in range(ji1):
		y[i] = '1'
	y = y[::-1]
print(''.join(y))


from collections import Counter, defaultdict, deque
read = lambda : list(map(int, input().split()))
getinfo = lambda grid: print(list(map(print, grid)))
p = lambda x: print(x, end=' ')
mod = 10 ** 9 + 7
inf = float('inf')
while True:
	try:
		s = input()
		cnt = s.count('1')
		res = ''
		for e in s:
			if e in '02':
				res += e
		try:
			index = res.index('2')
		except:
			index = len(res)
		print(res[:index] + cnt * '1' + res[index:])
	except:
		break


def main():
	s = input()
	n = len(s)
	nums = [[], [], []]
	if n == 1:
		print(s)
		return 0
	for i in range(n):
		nums[int(s[i])].append(i)
	if len(nums[0]) == 0:
		temp = len(nums[1])
		print('1' * temp + '2' * (n - temp))
	elif len(nums[2]) == 0:
		temp = len(nums[0])
		print('0' * temp + '1' * (n - temp))
	else:
		S = [i for i in s if i != '1']
		temp = len(nums[1])
		for i in range(len(S)):
			if S[i] == '2':
				break
		print(''.join(S[:i]) + temp * '1' + ''.join(S[i:]))
	return 0
main()


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
a = list(input().strip())
a = [int(i) for i in a]
idx = -1
try:
	idx = a.index(2)
except:
	pass
res = []
f = 1
for i in range(len(a)):
	if a[i] == 1:
		continue
	if a[i] == 2 and f:
		for j in range(a.count(1)):
			res.append(1)
		f = 0
	res.append(a[i])
while len(res) < len(a):
	res.append(1)
print(''.join((str(i) for i in res)))


si = input()
so = ''
ones = 0
for i in range(len(si)):
	if si[i] == '1':
		ones = ones + 1
i = 0
twos_found = False
for i in range(len(si)):
	if si[i] == '2' and (not twos_found):
		twos_found = True
		if ones > 0:
			so = so + '1' * ones
	if si[i] == '0' or si[i] == '2':
		so = so + si[i]
if ones > 0 and (not twos_found):
	so = so + '1' * ones
print(so)


s = input()
string = ''
c0 = 0
c1 = 0
c2 = 0
state = 0
p = 9999999
for i in range(len(s)):
	if state == 0:
		if s[i] == '1':
			c1 += 1
		elif s[i] == '0':
			c0 += 1
		else:
			c2 += 1
			for j in range(c0):
				string += '0'
			p = min(p, len(string))
			c0 = 0
			state = 1
	elif state == 1:
		if s[i] == '1':
			c1 += 1
		elif s[i] == '2':
			c2 += 1
		else:
			c0 += 1
			for j in range(c2):
				string += '2'
			c2 = 0
			state = 0
if p == 9999999:
	stt = ''
	for j in range(c0):
		stt += '0'
	for j in range(c1):
		stt += '1'
else:
	stt = string[0:p]
	for j in range(c1):
		stt += '1'
	stt += string[p:]
	if state == 0:
		for j in range(c0):
			stt += '0'
		for j in range(c2):
			stt += '2'
	else:
		for j in range(c2):
			stt += '2'
		for j in range(c0):
			stt += '0'
print(stt)


s = list(input())
(zeroes, ones, twos) = (s.count('0'), s.count('1'), s.count('2'))
news = []
for i in range(len(s)):
	if s[i] != '1':
		news.append(s[i])
if not twos:
	print(''.join(news) + '1' * ones)
	exit()
p = news.index('2')
newss = news[:p] + [str('1' * ones)] + news[p:]
print(''.join(newss))


s = input()
cnt1 = 0
ans = ''
for i in s:
	if i != '1':
		ans += i
	else:
		cnt1 += 1
f = 0
for i in range(len(ans)):
	if ans[i] == '2':
		ans = ans[0:i] + '1' * cnt1 + ans[i:len(ans)]
		f += 1
		break
if f == 0:
	ans += '1' * cnt1
print(ans)


s = input()
ans = s.replace('1', '') + '2'
t = ans.find('2')
print(ans[:t] + '1' * s.count('1') + ans[t:-1])


s = input()
ln = len(s)
o = s.count('1')
t = z = b = c = 0
for i in range(ln):
	if s[i] == '0' or s[i] == '2':
		if s[i] == '0':
			z = 1
			c += 1
		elif s[i] == '2':
			if z and c and (not b):
				for j in range(c):
					print(0, end='')
				for j in range(o):
					print(1, end='')
				print(2, end='')
				b = 1
				o = 0
				c = 0
			elif not b:
				for j in range(o):
					print(1, end='')
				print(2, end='')
				b = 1
				o = 0
			else:
				for j in range(c):
					print(0, end='')
				print(2, end='')
				c = 0
for i in range(c):
	print(0, end='')
for i in range(o):
	print(1, end='')


N = list(input())
N = [int(i) for i in N]
n = len(N)
two = n + 1
for i in range(n):
	if N[i] == 2:
		two = i
		break
N2 = ''
ones = 0
zeros = 0
for i in range(n - 1, -1, -1):
	if two <= i:
		if N[i] == 0:
			N2 = '0' + N2
		elif N[i] == 2:
			N2 = '2' + N2
		else:
			ones += 1
	elif N[i] == 0:
		zeros += 1
	else:
		ones += 1
print(zeros * '0' + ones * '1' + N2)


while True:
	try:

		def soln(s):
			n = len(s)
			zeon = []
			one = 0
			for i in range(n):
				if s[i] != '1':
					zeon.append(s[i])
				else:
					one += 1
			ans = []
			for j in range(len(zeon)):
				if zeon[j] == '2':
					for i in range(one):
						ans.append('1')
						one = 0
				ans.append(zeon[j])
			for j in range(one):
				ans.append('1')
			print(''.join(ans))

		def read():
			s = input()
			soln(s)
		if __name__ == '__main__':
			read()
	except EOFError:
		break


import sys
import string
import math
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def tmi(s):
	return tuple(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def js(lst):
	return ' '.join((str(d) for d in lst))

def jsns(lst):
	return ''.join((str(d) for d in lst))

def line():
	return sys.stdin.readline().strip()

def linesp():
	return line().split()

def iline():
	return int(line())

def mat(n):
	matr = []
	for _ in range(n):
		matr.append(linesp())
	return matr

def matns(n):
	mat = []
	for _ in range(n):
		mat.append([c for c in line()])
	return mat

def mati(n):
	mat = []
	for _ in range(n):
		mat.append(lmi(line()))
	return mat

def pmat(mat):
	for row in mat:
		print(js(row))

def dist(x, y):
	return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5

def fast_exp(x, n):
	if n == 0:
		return 1
	elif n % 2 == 1:
		return x * fast_exp(x, (n - 1) // 2) ** 2
	else:
		return fast_exp(x, n // 2) ** 2

def gcd(a, b):
	while b:
		a %= b
		(a, b) = (b, a)
	return a

def main():
	s = line()
	new_s = []
	i = 0
	while i < len(s):
		c = s[i]
		if c == '0':
			new_s.append(c)
			i += 1
		elif c == '1':
			one_count = 0
			zero_count = 0
			while i < len(s) and s[i] != '2':
				if s[i] == '1':
					one_count += 1
				elif s[i] == '0':
					zero_count += 1
				i += 1
			for _ in range(zero_count):
				new_s.append('0')
			for _ in range(one_count):
				new_s.append('1')
		elif c == '2':
			one_count = 0
			rest = []
			while i < len(s):
				if s[i] == '1':
					one_count += 1
				else:
					rest.append(s[i])
				i += 1
			for _ in range(one_count):
				new_s.append('1')
			new_s.extend(rest)
	print(jsns(new_s))
main()


str = input()
new1 = ''
new3 = ''
count = 0
state = 1
for char in str:
	if char == '1':
		count += 1
	else:
		if char == '2' and state == 1:
			state = 2
		if state == 1:
			new1 += char
		else:
			new3 += char
new2 = '1' * count
new = new1 + new2 + new3
print(new)


s = input()
ans = []
ones = 0
for i in s:
	if i != '1':
		ans += [i]
	else:
		ones += 1
i = 0
n = len(ans)
while i < n and ans[i] != '2':
	print(0, end='')
	i += 1
print('1' * ones, end='')
while i < n:
	print(ans[i], end='')
	i += 1


s = list(input())
count = 0
for i in range(len(s) - 1, -1, -1):
	if s[i] == '1':
		count += 1
		del s[i]
try:
	mark = s.index('2')
except:
	mark = -1
if mark == -1:
	s.extend(['1'] * count)
else:
	s = s[:mark] + ['1'] * count + s[mark:]
print(*s, sep='')


s = list(input())
tmp = ''
res = ''
if '0' not in s or '2' not in s:
	res = ''.join(sorted(s))
else:
	ind = s.index('2')
	res += ''.join(sorted(s[:ind]))
	ones = s[ind:].count('1')
	res += ones * '1'
	lst = [x for x in s[ind:] if x != '1']
	res += ''.join(lst)
print(res)


a = input()
s = ''
final = ''
count = 0
for i in a:
	if i == '1':
		count += 1
	else:
		s += i
s += '2'
i = s.find('2')
print(s[:i] + '1' * count + s[i:-1])


s = input().strip()
ones = s.count('1')
s = ''.join(filter(lambda c: c != '1', s))
indx = s.find('2')
if indx == -1:
	print(s + '1' * ones)
else:
	print(s[:indx] + '1' * ones + s[indx:])


s = input()
l = len(s)
z = -1
c0 = 0
c1 = 0
c2 = 0
loc = -1
for i in range(l):
	c = s[i]
	if c == '0':
		c0 += 1
	if c == '1':
		c1 += 1
	if c == '2':
		c2 += 1
		if z == -1:
			z = c0
			loc = i
if z == -1:
	for i in range(c0):
		print(0, end='')
	for i in range(c1):
		print(1, end='')
	print()
else:
	for i in range(z):
		print(0, end='')
	for i in range(c1):
		print(1, end='')
	for i in range(loc, l):
		if s[i] != '1':
			print(s[i], end='')
	print()


s = input()
num_ones = s.count('1')
s = s.replace('1', '')
if '2' in s:
	first_two = s.index('2')
	s = s[0:first_two] + '1' * num_ones + s[first_two:]
else:
	s += '1' * num_ones
print(s)


s = input()
l = len(s)
count_1 = s.count('1')
new_out = ''
red = ''.join([c for c in s if c != '1'])
out = ''
try:
	insert = red.index('2')
	out = red[:insert] + '1' * count_1 + red[insert:]
except:
	out = red + '1' * count_1
print(out)


def main():
	s = input()
	if '1' in s:
		t = s.replace('1', '')
		(u, v, *_) = t.split('2', 1) + ['*']
		print(u, '1' * (len(s) - len(t)), *(['2', v] if v != '*' else []), sep='')
	else:
		print(s)
main()


s = input()
c1 = s.count('1')
cc = '1' * c1
if c1 == 0:
	print(s)
elif s.count('2') == 0:
	print('0' * s.count('0') + cc)
else:
	ans = ''
	for i in range(len(s)):
		if s[i] != '1':
			ans += s[i]
	ind = ans.index('2')
	ans1 = [ans[:ind], cc, ans[ind:]]
	print(''.join(ans1))


def go():
	a = [int(i) for i in input()]
	i = 0
	c = 0
	while i < len(a):
		if a[i] == 1:
			a[i] = None
			c += 1
		i += 1
	j = 0
	a = [j for j in a if j is not None]
	while j < len(a):
		if a[j] == 2:
			break
		j += 1
	output = ''.join((str(i) for i in a[:j]))
	output += '1' * c
	output += ''.join((str(i) for i in a[j:]))
	return output
print(go())


from array import array
from sys import stdin
import bisect
from bisect import *
import itertools
from itertools import *

def scan_gen():
	for line in stdin:
		yield from iter(line.split())
scan = scan_gen()

def nint():
	return int(next(scan))

def nintk(k):
	return tuple((nint() for _ in range(k)))

def nfloat():
	return float(next(scan))

def intar_init(size):
	return array('i', [0]) * size

def intar(size=None):
	if size == None:
		size = nint()
	arr = intar_init(size)
	for x in range(size):
		arr[x] = nint()
	return arr

def solve():
	s = input()
	ones = s.count('1')
	s = s.replace('1', '')
	try:
		ti = s.index('2')
		res = s[:ti] + '1' * ones + s[ti:]
	except ValueError:
		res = s + '1' * ones
	print(res)
solve()


s = input()
comeco0 = ''
comeco1 = ''
final = ''
achei2 = False
for num in s:
	if num == '0':
		if achei2 == False:
			comeco0 += '0'
		else:
			final += '0'
	if num == '1':
		comeco1 += '1'
	if num == '2':
		achei2 = True
		final += '2'
print(comeco0, end='')
print(comeco1, end='')
print(final, end='')


s = input()
l = len(s)
i = 0
while i < l and s[i] != '2':
	i += 1
a = sorted(s[0:i])
fir = []
sec = []
while i < l:
	if s[i] == '1':
		fir += [s[i]]
	else:
		sec += [s[i]]
	i += 1
r = a + fir + sec
print(''.join(r))


a = [i for i in input()]
n = a.count('1')
b = [i for i in a if i != '1']
if '2' in b:
	x = b.index('2')
	print(''.join(b[:x]) + n * '1' + ''.join(b[x:]))
else:
	print(''.join(b) + n * '1')


params = input()
params = list(params)
zero = 0
one = 0
x = 0
while x < params.__len__():
	if params[x] == '1':
		one += 1
		params.pop(x)
	else:
		x += 1
x = 0
while x < params.__len__():
	if params[x] == '2':
		break
	else:
		zero += 1
		params.pop(x)
params.insert(0, '1' * one)
params.insert(0, '0' * zero)
s = ''
print(s.join(params))


s = input()
one = s.count('1')
if one == 0:
	print(s)
	exit()
ind = s.find('2')
ans = ''
for i in range(len(s)):
	if i == ind:
		ans += '1' * one
	if s[i] == '1':
		continue
	ans += s[i]
if ind == -1:
	ans += '1' * one
print(ans)


s = input()
n = len(s)
(t, e) = (0, 0)
r = ''
for i in range(n):
	t += s[i] == '1'
for i in range(n):
	if s[i] == '0':
		r += '0'
	elif s[i] == '2':
		if not e:
			r += '1' * t
			(t, e) = (0, 1)
		r += '2'
if not e:
	r += '1' * t
print(r)


from collections import Counter

def main():
	s = input().strip()
	num_ones = sum((1 for e in s if e == '1'))
	s_lst = [e for e in s if e != '1']
	first2index = s.find('2')
	if first2index == -1:
		ans = '0' * (len(s) - num_ones) + '1' * num_ones
	else:
		idx2 = s_lst.index('2')
		ans = s_lst[:idx2]
		ans += ['1'] * num_ones
		ans += s_lst[idx2:]
		ans = ''.join(ans)
	print(ans)
main()


s = input()
a = ''
s = s[::-1]
o = 0
z = 0
i = 0
while i != len(s):
	if s[i] == '2':
		a = a + '0' * z + '2'
		z = 0
	if s[i] == '0':
		z += 1
	if s[i] == '1':
		o += 1
	i += 1
a = a + '1' * o + '0' * z
a = a[::-1]
print(a)


import sys
input = sys.stdin.readline
s = input().strip('\n')
b = []
c = 0
last = -1
for i in range(len(s)):
	if s[i] == '1':
		c += 1
	else:
		b.append(s[i])
		if s[i] == '2' and last == -1:
			last = len(b) - 1
if last != -1:
	b = ''.join(b[:last]) + '1' * c + ''.join(b[last:])
else:
	b = ''.join(b) + '1' * c
print(b)


o = ''
s = input()
x = s.count('1')
s2 = s.replace('1', '')
i = s2.find('2')
if i == -1:
	print(s2 + '1' * x)
else:
	print(s2[:i] + '1' * x + s2[i:])


s = input()
oneCnt = 0
for c in s:
	if c == '1':
		oneCnt += 1
sNo1s = s.replace('1', '')
oneStr = '1' * oneCnt
first2 = sNo1s.find('2')
if first2 < 0:
	print(sNo1s + oneStr)
else:
	print(sNo1s[:first2] + oneStr + sNo1s[first2:])


import sys
from collections import Counter
from sys import stdin, stdout
s = list(stdin.readline().strip())
d = Counter(s)
ans = []
if len(list(d.keys())) > 2:
	for i in range(len(s)):
		if s[i] == '0':
			stdout.write(s[i])
			s[i] = '-'
		if s[i] == '2':
			break
	for i in range(len(s)):
		if s[i] == '1':
			stdout.write(s[i])
	for i in range(len(s)):
		if s[i] == '2' or s[i] == '0':
			stdout.write(s[i])
elif '0' in d and '2' in d:
	stdout.write(''.join(s))
else:
	for i in range(3):
		stdout.write(str(i) * d[str(i)])


S = input()
x = S.count('1')
T = S.replace('1', '')
if '2' in T:
	ans = T[:T.index('2')] + '1' * x + T[T.index('2'):]
else:
	ans = T + '1' * x
print(ans)


fixed = set(['0', '2'])

def sort(ss):
	out = []
	count = 0
	for a in ss:
		if a in fixed:
			out.append(a)
		else:
			count += 1
	ind = 0
	for a in out:
		if a == '0':
			ind += 1
			continue
		break
	out.insert(ind, ''.join(['1' for b in range(count)]))
	return ''.join(out)
print(sort(input()))


count1 = 0
result = []
a = input()
for i in a:
	if i == '1':
		count1 += 1
	elif i == '0' or i == '2':
		result.append(i)
try:
	index = result.index('2')
	temp = result[index:]
	result = result[:index] + ['1'] * count1 + temp
except ValueError:
	result.extend(['1'] * count1)
print(''.join(result))


arr = input()
arr = list(arr)
n = len(arr)
zeros_after = 0
ones_after = 0
i = 0
while i < n:
	if arr[i] == '2':
		break
	i += 1
x = i
while i < n:
	if arr[i] == '0':
		zeros_after += 1
	elif arr[i] == '1':
		ones_after += 1
	i += 1
first = arr[0:x]
first.sort()
for i in range(x, n):
	if arr[i] == '1':
		arr[i] = '3'
ans = []
for i in arr:
	if i != '3':
		ans.append(i)
for i in range(ones_after):
	first.append('1')
print(''.join(first + ans[x:]))


s = list(str(input()))
empty = ''
for i in range(len(s)):
	zero = 0
	if s[i] == '2':
		for t in range(i + 1, len(s)):
			if s[t] == '0':
				zero += 1
			if s[t] == '2':
				break
		empty += '2' + '0' * zero
empty = (s.count('0') - empty.count('0')) * '0' + '1' * s.count('1') + empty
print(empty)