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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {

    private int[] numberOfDigit;
    private int[] numberOfDigit2;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        res = in.nextString();
        res2 = res;
        char[] c = res.toCharArray();
        numberOfDigit = new int[10];
        for (char cc : c) {
            numberOfDigit[cc - '0']++;
        }
        numberOfDigit2 = numberOfDigit.clone();
        for (int numZeros = 0; numZeros <= numberOfDigit[0]; ++numZeros) {
            for (int i = 1; i <= 9; ++i) {
                if (numberOfDigit[i] > 0 && numberOfDigit[10 - i] > 0) {
                    tryIt(i, 10 - i, numZeros);
                }
            }
        }
        if (best == 0) {
            best = numberOfDigit[0];
            bestZeros = numberOfDigit[0];
            bestI = -1;
        }
        constructIt();
        out.println(res);
        out.println(res2);
    }

    private void constructIt() {
        if (best == 0) {
            return;
        }
        StringBuilder b1 = new StringBuilder("");
        StringBuilder b2 = new StringBuilder("");
        for (int i = 0; i < bestZeros; ++i) {
            b1.append('0');
            b2.append('0');
        }
        numberOfDigit[0] -= bestZeros;
        numberOfDigit2[0] -= bestZeros;
        if (bestI != -1) {
            b1.append(bestI);
            numberOfDigit[bestI]--;
            b2.append(10 - bestI);
            numberOfDigit2[10 - bestI]--;

            for (int i = 0; i < 10; ++i) {
                int am = Math.min(numberOfDigit[i], numberOfDigit2[9 - i]);
                for (int j = 0; j < am; ++j) {
                    b1.append(i);
                    b2.append(9 - i);
                    numberOfDigit[i]--;
                    numberOfDigit2[9 - i]--;
                }
            }
        }
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < numberOfDigit[i]; ++j) {
                b1.append(i);
            }
            for (int j = 0; j < numberOfDigit2[i]; ++j) {
                b2.append(i);
            }
        }
        b1.reverse();
        b2.reverse();
        res = b1.toString();
        res2 = b2.toString();
    }

    private void tryIt(int c, int c2, int numZeros) {
        --numberOfDigit[c];
        --numberOfDigit2[c2];
        numberOfDigit[0] -= numZeros;
        numberOfDigit2[0] -= numZeros;
        int cur = numZeros + 1;

        for (int i = 0; i < 10; ++i) {
            cur += Math.min(numberOfDigit[i], numberOfDigit2[9 - i]);
        }
        if (cur > best) {
            best = cur;
            bestZeros = numZeros;
            bestI = c;
        }

        numberOfDigit[0] += numZeros;
        numberOfDigit2[0] += numZeros;
        ++numberOfDigit[c];
        ++numberOfDigit2[c2];
    }

    int best = 0;
    int bestZeros;
    int bestI;
    String res;
    String res2;
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

}