Problem: Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.

Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so on (arbitrary number of changes could be made in each number). At some point it turned out that if we sum the resulting numbers, then the number of zeroes with which the sum will end would be maximum among the possible variants of digit permutations in those numbers.

Given number n, can you find the two digit permutations that have this property?

Input

The first line contains a positive integer n — the original number. The number of digits in this number does not exceed 105. The number is written without any leading zeroes.

Output

Print two permutations of digits of number n, such that the sum of these numbers ends with the maximum number of zeroes. The permutations can have leading zeroes (if they are present, they all should be printed). The permutations do not have to be different. If there are several answers, print any of them.

Examples

Input

198


Output

981
819


Input

500


Output

500
500

Solution (in PYTHON):

Solution:
s=raw_input()
a=[s.count(`x`) for x in range(10)]+[0]
b=a[:]
u,v=0,0
F=range(10)
R=lambda x:x[::-1]
for i in F:
  if a[i] and b[10 - i]:
    a[i]-=1;b[10-i]-=1
    c=1+sum(min(a[x],b[9-x]) for x in F)
    if c>v:u,v=i,c
    a[i]+=1;b[10-i]+=1
d=max(0,a[0]-a[9])
a[0]-=d;b[0]-=d
x=y='0'*d
if v:
  x+=`u`;y+=`10-u`
  a[u]-=1;b[10-u]-=1
for i in F:
  j=min(a[i],b[9-i])
  x+=`i`*j;y+=`9-i`*j
  a[i]-=j;b[9-i]-=j
for i in F:x+=`i`*a[i];y+=`i`*b[i]
print R(x)
print R(y)




# Made By Mostafa_Khaled