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:
n=map(int,raw_input())
cnt1=[len(filter(lambda x:x==i,n)) for i in range(10)]
cnt2=list(cnt1)
d1,d2=[],[]
best_c=best_r=0
for i in range(1,10):
    if (cnt1[i]>0) and (cnt2[10-i]>0):
        cnt1[i]-=1
        cnt2[10-i]-=1
        gg=1
        for j in range(10):
            gg+=min(cnt1[j],cnt2[9-j])
        cnt1[i]+=1
        cnt2[10-i]+=1
        if gg>best_r:
            best_c,best_r=i,gg
if best_r!=0:
    d1.append(best_c)
    d2.append(10-best_c)
    cnt1[best_c]-=1
    cnt2[10-best_c]-=1
    for i in range(10):
        for j in range(min(cnt1[i],cnt2[9-i])):
            d1.append(i)
            d2.append(9-i)
            cnt1[i]-=1
            cnt2[9-i]-=1
zz=min(cnt1[0],cnt2[0])          
d1=[0]*zz+d1
d2=[0]*zz+d2
cnt1[0]-=zz
cnt2[0]-=zz 
for i in range(10):
    for j in range(cnt1[i]):
        d1.append(i)
    for j in range(cnt2[i]):
        d2.append(i)
print "\n".join("".join(map(str,reversed(i))) for i in (d1,d2))