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;

public class D {
    static int max = 0;
    static int[] D1 = new int[10];
    static int[] D2 = new int[10];
    static char[] ans1;
    static char[] ans2;
    static char[] res1;
    static char[] res2;

    public static void rec(int x1, int x2, int c) {
        if (D1[x1] > 0 && D2[x2] > 0) {
            D1[x1]--;
            D2[x2]--;
            ans1[c] = (char) ('0' + x1);
            ans2[c--] = (char) ('0' + x2);
        } else {
            return;
        }
        int z = 1;
        // need carry 1
        boolean cont = true;
        while (cont) {
            cont = false;
            for (int i = 0; i < 10; i++)
                for (int j = 0; j < 10; j++) {
                    if ((i + j + 1) % 10 == 0) {
                        if (D1[i] > 0 && D2[j] > 0) {
                            z++;
                            D1[i]--;
                            D2[j]--;
                            ans1[c] = (char) (i + '0');
                            ans2[c--] = (char) (j + '0');
                            cont = true;
                        } else if (D1[j] > 0 && D2[i] > 0) {
                            D1[j]--;
                            D2[i]--;
                            ans1[c] = (char) (j + '0');
                            ans2[c--] = (char) (i + '0');
                            cont = true;
                            z++;
                        }
                    }
                }
        }

        // fill the rest
        int temp = c;
        int toAdd = Math.min(D1[0], D2[0]);
        D1[0] -= toAdd;
        D2[0] -= toAdd;
        for (int i = 0; i < 10; i++) {
            while (D1[i]-- > 0) {
                ans1[c--] = (char) (i + '0');
            }
        }
        for (int i = 0; i < 10; i++) {
            while (D2[i]-- > 0) {
                ans2[temp--] = (char) (i + '0');
            }
        }
        if (z + toAdd > max) {
            int last = ans1.length - 1;
            int temp2 = toAdd;
            max = z + toAdd;
            while (toAdd-- > 0) {
                res1[last--] = '0';
            }
            last = ans1.length - 1;
            while (temp2-- > 0) {
                res2[last--] = '0';
            }
            for (int i = ans1.length - 1; i >= 0 && last >= 0; i--, last--) {
                res1[last] = ans1[i];
                res2[last] = ans2[i];
            }
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s = in.readLine();
        int n = s.length();
        ans1 = new char[n];
        ans2 = new char[n];
        res1 = new char[n];
        res2 = new char[n];
        int c = n - 1;
        int[] A = new int[10];
        for (int i = 0; i < n; i++) {
            A[s.charAt(i) - '0']++;
        }
        for (int i = 1; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                D1[j] = D2[j] = A[j];
            }
            rec(i, 10 - i, c);
        }
        if (max == 0) {
            int last = n - 1;
            for (int i = 0; i < 10; i++) {
                while (A[i]-- > 0) {
                    res1[last] = res2[last] = (char) (i + '0');
                    last--;
                }
            }
        }
        System.out.println(new String(res1));
        System.out.println(new String(res2));
    }
}