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 static java.util.Arrays.*;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import java.util.*;
import java.math.*;
import java.io.*;

public class B implements Runnable
{
    String file = "input";
    
    boolean TEST = System.getProperty("ONLINE_JUDGE") == null;
    
    void solve() throws IOException
    {
        char[] cs = next().toCharArray();
        int n = cs.length;
        int[] a = new int[10];
        for(char c : cs) a[c - '0']++;
        int[] b = a.clone();
        int res = 0;
        int x = -1;
        for(int i = 1; i <= 5; i++)
            if(a[i] >= 1 && b[10 - i] >= 1)
            {
                a[i]--;
                b[10 - i]--;
                int tmp = get(a, b) + 1;
                if(tmp > res)
                {
                    res = tmp;
                    x = i;
                }
                a[i]++;
                b[10 - i]++;
            }   
        
        StringBuilder sb0 = new StringBuilder();
        StringBuilder sb1 = new StringBuilder();
        
        if(x > 0)
        {
            sb0.append(x);
            sb1.append(10 - x);
            a[x]--;
            b[10 - x]--;
            StringBuilder[] str = getStr(a, b);
            sb0 = sb0.append(str[0]).reverse();
            sb1 = sb1.append(str[1]).reverse();
        }
        
        StringBuilder sb10 = new StringBuilder();
        StringBuilder sb11 = new StringBuilder();
        
        for(int i = 1; i < 10; i++)
        {
            while(a[i] > 0)
            { 
                sb10.append(i);
                a[i]--;
            }
            while(b[i] > 0)
            {
                sb11.append(i);
                b[i]--;
            }
        }
        
        sb0.insert(0, sb10);
        sb1.insert(0, sb11);
        
        while(a[0] > 0 && b[0] > 0)
        {
            sb0.append('0');
            sb1.append('0');
            a[0]--; b[0]--;
        }
        StringBuilder sb00 = new StringBuilder();
        while(a[0] > 0)
        {
            sb00.append('0');
            a[0]--;
        }
        StringBuilder sb01 = new StringBuilder();
        while(b[0] > 0)
        {
            sb01.append('0');
            b[0]--;
        }
        sb0 = sb00.append(sb0);
        sb1 = sb01.append(sb1);
        out.println(sb0.toString());
        out.println(sb1.toString());
    }
    
    StringBuilder[] getStr(int[] a, int[] b)
    {
        StringBuilder sb0 = new StringBuilder();
        StringBuilder sb1 = new StringBuilder();
        for(int i = 0; i <= 9; i++)
        {
            int m = min(a[i], b[9 - i]);
            while(m > 0)
            {
                sb0.append(i);
                sb1.append(9 - i);
                m--;
                a[i]--;
                b[9 - i]--;
            }
        }
        return new StringBuilder[] {sb0, sb1};
    }
    
    int get(int[] a, int[] b)
    {
        int res = 0;
        for(int i = 0; i <= 9; i++) res += min(a[i], b[9 - i]);
        return res;
    }
    
    
    String next() throws IOException
    {
        while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.readLine());
        return st.nextToken();
    }
    
    int nextInt() throws IOException
    {
        return Integer.parseInt(next());
    }
    
    long nextLong() throws IOException
    {
        return Long.parseLong(next());
    }
    
    double nextDouble() throws IOException
    {
        return Double.parseDouble(next());
    }
    
    void print(Object... o)
    {
        System.out.println(deepToString(o));
    }
    
    void gcj(Object o)
    {
        String s = String.valueOf(o);
        out.println("Case #" + test + ": " + s);
        System.out.println("Case #" + test + ": " + s);
    }
    
    BufferedReader input;
    PrintWriter out;
    StringTokenizer st;
    int test;
    
    void init() throws IOException
    {
        if(TEST) input = new BufferedReader(new FileReader(file + ".in")); 
        else input = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new BufferedOutputStream(System.out));
    }
    
    public static void main(String[] args) throws IOException
    {
        new Thread(null, new B(), "", 1 << 20).start();
    }
    
    public void run()
    {
        try
        {
            init();
            if(TEST) 
            {
                int runs = nextInt();
                for(int i = 0; i < runs; i++) solve();
            }
            else solve();
            out.close();        
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.exit(1);
        }
    }
}