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.io.*;
import java.math.*;
import java.util.*;

public class Main
{
    BufferedReader reader;
    FastScanner sc;
    
    void solve() throws Exception
    {
        //for (int CASE = 0; CASE < 10000; CASE++)
        //{
        //  System.out.println("CASE: " + CASE);
        //String nstr = Integer.toString(CASE);
        String nstr = reader.readLine();
        int[] n = new int[nstr.length()];
        for (int i = 0; i < nstr.length(); i++)
        {
            n[i] = nstr.charAt(i) - '0';
        }
        
        int[] digitcount = new int[10];
        
        for (int i = 0; i < n.length; i++)
        {
            digitcount[n[i]]++;
        }
        
        int[] digitcount1 = digitcount.clone();
        int[] digitcount2 = digitcount.clone();
        
        int[] result1 = new int[n.length];
        int[] result2 = new int[n.length];
        
        int pos = nstr.length() - 1;
        
        int[] maxdigitcount1 = digitcount1;
        int[] maxdigitcount2 = digitcount2;
        int[] maxresult1 = result1;
        int[] maxresult2 = result2;
        int minpos = pos;
        
    outer:
        for (int i = 1; i <= 5; i++)
        {
            pos = nstr.length() - 1;
            digitcount1 = digitcount.clone();
            digitcount2 = digitcount.clone();
            result1 = new int[n.length];
            result2 = new int[n.length];
            
            if (digitcount[i] != 0 && digitcount[10 - i] != 0)
            {
                digitcount1[i]--;
                digitcount2[10 - i]--;
                
                int halfchainlength = Math.min(digitcount2[9], digitcount2[0]);
                
                for (int j = 0; j < digitcount[0] - halfchainlength; j++)
                {
                    result1[pos] = result2[pos] = 0;
                    pos--;
                }
                
                result1[pos] = i;
                result2[pos] = 10 - i;
                pos--;
                
                for (int j = 0; j < halfchainlength; j++)
                {
                    result1[pos] = 0;
                    result2[pos] = 9;
                    pos--;
                }
                
                for (int j = 0; j < halfchainlength; j++)
                {
                    result1[pos] = 9;
                    result2[pos] = 0;
                    pos--;
                }
                
                digitcount1[0] -= halfchainlength;
                digitcount2[0] -= halfchainlength;
                digitcount1[9] -= halfchainlength;
                digitcount2[9] -= halfchainlength;
                
                digitcount1[0] = digitcount2[0] = 0;
                
                for (int j = 1; j <= 8; j++)
                {
                    if (digitcount1[j] != 0 && digitcount2[9 - j] != 0)
                    {
                        int count = Math.min(digitcount1[j], digitcount2[9 - j]);
                        
                        for (int k = 0; k < count; k++)
                        {
                            result1[pos] = j;
                            result2[pos] = 9 - j;
                            digitcount1[j]--;
                            digitcount2[9 - j]--;
                            pos--;
                        }
                    }
                }
                
                if (pos < minpos)
                {
                    maxdigitcount1 = digitcount1;
                    maxdigitcount2 = digitcount2;
                    maxresult1 = result1;
                    maxresult2 = result2;
                    minpos = pos;
                    //System.out.println(minpos);
                }
            }
        }
        
        digitcount1 = maxdigitcount1;
        digitcount2 = maxdigitcount2;
        result1 = maxresult1;
        result2 = maxresult2;
        pos = minpos;
        
        int minzero = Math.min(digitcount1[0], digitcount2[0]);
        
        for (int j = 0; j < minzero; j++)
        {
            result1[pos] = result2[pos] = 0;
            digitcount1[0]--;
            digitcount2[0]--;
            pos--;
        }
        
        int pos1 = pos;
        for (int i = 9; i >= 0; i--)
        {
            while (digitcount1[i] > 0)
            {
                result1[pos1--] = i;
                digitcount1[i]--;
            }
        }
        int pos2 = pos;
        for (int i = 9; i >= 0; i--)
        {
            while (digitcount2[i] > 0)
            {
                result2[pos2--] = i;
                digitcount2[i]--;
            }
        }
        
        
        for (int i = 0; i < n.length; i++)
        {
            System.out.print(result1[i]);
        }
        System.out.println();
        for (int i = 0; i < n.length; i++)
        {
            System.out.print(result2[i]);
        }
        System.out.println();
        //}
    }
        
    public static void main(String[] args) throws Exception
    {
        new Main().solve();
    }
    
    Main() throws Exception
    {
        if (System.getProperty("ONLINE_JUDGE") == null)
        {
            //System.setIn(new FileInputStream("input.txt"));
            //System.setOut(new PrintStream("output.txt"));
        }
        
        reader = new BufferedReader(new InputStreamReader(System.in));
        sc = new FastScanner(reader);
    }
}

class FastScanner
{
    BufferedReader reader;
    StringTokenizer strTok;
    
    public FastScanner(BufferedReader reader)
    {
        this.reader = reader;
    }
    
    public String nextToken() throws IOException
    {
        if (strTok == null || !strTok.hasMoreTokens())
        {
            strTok = new StringTokenizer(reader.readLine());
        }
        return strTok.nextToken();
    }
    
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextToken());
    }
    
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextToken());
    }
    
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextToken());
    }
    
    public BigInteger nextBigInteger() throws IOException
    {
        return new BigInteger(nextToken());
    }
    
    public BigDecimal nextBigDecimal() throws IOException
    {
        return new BigDecimal(nextToken());
    }
}