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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.math.BigInteger;

/**
 * Created by IntelliJ IDEA.
 * User: aircube
 */
public class Main implements Runnable{
    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public static void main(String[] args)  {
        new Thread(null, new Main(), "", 256*(1L<<20)).start();
        
    }

    public void run() {
        try{
            tokenizer = null;
            reader = new BufferedReader(new InputStreamReader(System.in));
            writer = new PrintWriter(System.out);
            solve();
            writer.flush();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
        
    }


    private void solve() throws IOException {
        char[] a = nextToken().toCharArray();
        int b1[] = calc(a);
        int b2[] = calc(a);

        int ans = -1;
        int bestnules = - 1, bestbestD =-1, bestbestE=-1;
        
        for (int nn = 0; nn <= b1[0]; ++nn) {
            int nules = nn;
            int[] c1 = b1.clone();
            int[] c2 = b2.clone();
            c1[0] -= nules;
            c2[0] -= nules;
            
            int best = nules;
            int bestD = -1, bestE = -1;
            for (int d = 0; d < 10; ++d)
                for (int e = 0; e < 10; ++e)
                    if (d + e == 10 && c1[d] > 0 && c2[e] > 0) {
                        int tc1[] = c1.clone();
                        int tc2[] = c2.clone();
                        tc1[d] --;
                        tc2[e] -- ;
                        int cur = 1 + nules;
                        for (int i = 0; i < 10; ++i) {
                            cur += Math.min(tc1[i], tc2[9-i]);
                        }
                        if (cur > best) {
                            best = cur;
                            bestD = d;
                            bestE = e;
                        }
                    }
            if (best > ans) {
                ans = best;
                bestbestD = bestD;
                bestnules = nules;
                bestbestE = bestE;
            }
        }
        StringBuilder str1 = new StringBuilder();
        StringBuilder str2 = new StringBuilder();
        for (int i = 0; i < bestnules; ++i) {
            str1.append('0');
            str2.append('0');
        }
        int tc1[] = b1.clone();
        int tc2[] = b2.clone();
        tc1[0] -= bestnules;
        tc2[0] -= bestnules;

        if (bestbestD != -1) {
            tc1[bestbestD] --;
            tc2[bestbestE] -- ;

            str1.appendCodePoint((char) (bestbestD+ '0'));
            str2.appendCodePoint((char) (bestbestE+ '0'));
            for (int i = 0; i < 10; ++i) {
                int d = Math.min(tc1[i], tc2[9-i]);
                int z=d;
                while (z --> 0) {
                    str1.appendCodePoint((char) (i + '0'));
                    str2.appendCodePoint((char) (9 - i + '0'));
                }
                tc1[i] -= d;
                tc2[9-i] -= d;
            }
        }

        for (int i=0;i<10;++i) {
            while (tc1[i] --> 0)
                str1.appendCodePoint((char) (i + '0'));
            while (tc2[i] --> 0)
                str2.appendCodePoint((char) (i + '0'));
        }
        str1.reverse();
        str2.reverse();
        writer.println(str1.toString());
        writer.println(str2.toString());
        
        //writer.print(new BigInteger(str1.toString()).add(new BigInteger(str2.toString())));
        

        

    }

    private int[] calc(char[] a) {
        int[] res = new int[10];
        for (char x : a)
            res[x - '0'] ++;
        return res;
    }


    String nextToken()  throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(reader.readLine());
        return tokenizer.nextToken();
    }

    int nextInt()  throws IOException {
        return Integer.parseInt(nextToken());
    }

    double nextDouble()  throws IOException {
        return Double.parseDouble(nextToken());
    }

    Long nextLong()  throws IOException {
        return Long.parseLong(nextToken());
    }

}