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 JAVA):

Solution:
import java.util.Arrays;
import java.util.Scanner;

public class d99 {

    public static void debug(Object... obs)
    {
        System.out.println(Arrays.deepToString(obs));
    }

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        String n=sc.next();
        
        int[]digs1=new int[10];
        int[]digs2=new int[10];
        
        for(int i=0;i<n.length();i++)
        {
            int z=n.charAt(i)-'0';
            digs1[z]++;
            digs2[z]++;
        }
        
        //digs1[0]=0;
        //digs2[0]=0;
        StringBuilder sb1=new StringBuilder();
        StringBuilder sb2=new StringBuilder();
        
        //append(sb1,0,maxd);
        //append(sb2,0,maxd);
        
        int carry=0;
        int whichc = 0;
        int maxd = Integer.MIN_VALUE;
        for(int i=1;i<10;i++)
        {
            int f=Math.min(digs1[i], digs2[10-i]);
            if(f>0)
            {
                int nm=0;
                int[]ndigs1=Arrays.copyOf(digs1, 10);
                int[]ndigs2=Arrays.copyOf(digs2, 10);
                ndigs1[i]--;
                ndigs2[10-i]--;
                carry=1;
                for(int j=9;j>=0 && carry==1;j--)
                {
                    if(i==0 && carry==0)continue;
                    f=Math.min(ndigs1[j], ndigs2[10-carry-j]);
                    ndigs1[j]-=f;
                    ndigs2[10-carry-j]-=f;
                    //debug(i,10-carry-i,f,carry);
                    //debug(digs1);
                    //debug(digs2);
                    nm+=f;
                }
                int zero=Math.min(ndigs1[0], ndigs2[0]);
                nm+=zero;
                
                if(nm > maxd)
                {
                    whichc = i;
                    maxd = nm;
                }
            }
        }
        
        if(carry==1)
        {
            digs1[whichc]--;
            digs2[10-whichc]--;
            append(sb1,whichc,1);
            append(sb2,10-whichc,1);
        }
        
        for(int i=9;i>=0 && carry==1;i--)
        {
            if(i==0 && carry==0)continue;
            int f=Math.min(digs1[i], digs2[10-carry-i]);
            digs1[i]-=f;
            digs2[10-carry-i]-=f;
            append(sb1,i,f);
            append(sb2,10-carry-i,f);
            //debug(i,10-carry-i,f,carry);
            //debug(digs1);
            //debug(digs2);
        }
        int zero=Math.min(digs1[0], digs2[0]);
        digs1[0]-=zero;
        digs2[0]-=zero;
        
        for(int i=0;i<digs1.length;i++)
        {
            if(digs1[i]>0)
                append(sb1,i,digs1[i]);
        }
        for(int i=0;i<digs1.length;i++)
        {
            if(digs2[i]>0)
                append(sb2,i,digs2[i]);
        }
        
        sb1=sb1.reverse();
        sb2=sb2.reverse();
        append(sb1,0,zero);
        append(sb2,0,zero);
        System.out.println(sb1.toString());
        System.out.println(sb2.toString());
    }

    private static void append(StringBuilder sb1, int d, int maxd)
    {
        for(int i=0;i<maxd;i++)
            sb1.append(d);
        
    }
    
}