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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;


public class B138 {

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int[]d1 = new int[10], d2 = new int[10];
        while (true) {
            int w = (int)br.read();
            if (w==13)
                break;
            d1[w-48]++;
            d2[w-48]++;
        }
        int[][]ten = {{2,8}, {3,7}, {4,6}, {5,5}, {1,9}};
        int[][]nine = {{1,8}, {2,7}, {3,6}, {4,5}, {5,4}, {6,3}, {7,2}, {8,1}, {0,9}, {9,0}};
        int[]zero = new int[5];
        int max = 0, k = -1;
        for (int t = 0; t < 5; t++) {
            if (d1[ten[t][0]] > 0 && d2[ten[t][1]] > 0) {
                zero[t] = 1;
                d1[ten[t][0]]--;
                d2[ten[t][1]]--;
                int[]min = new int[10];
                for (int i = 0; i < 10; i++) {
                    min[i] = Math.min(d1[nine[i][0]], d2[nine[i][1]]);
                    zero[t] += min[i];
                    d1[nine[i][0]] -= min[i];
                    d2[nine[i][1]] -= min[i];
                }
                zero[t] += Math.min(d1[0], d2[0]);
                if (zero[t] > max){
                    max = zero[t];
                    k = t;
                }
                for (int i = 0; i < 10; i++) {
                    d1[nine[i][0]] += min[i];
                    d2[nine[i][1]] += min[i];
                }
                d1[ten[t][0]]++;
                d2[ten[t][1]]++;
            }
        }
        if (k==-1) {
            for (int i = 1; i <= 9; i++) {
                for (int j = 1; j <= d1[i]; j++) {
                    pw.print(i);
                }
            }
            for (int i = 1; i <= d1[0] ; i++) {
                pw.print(0);
            }
            pw.println();
            for (int i = 1; i <= 9; i++) {
                for (int j = 1; j <= d1[i]; j++) {
                    pw.print(i);
                }
            }
            for (int i = 1; i <= d1[0] ; i++) {
                pw.print(0);
            }
        }
        else {
            int[]min = new int[10];
            d1[ten[k][0]]--;
            d2[ten[k][1]]--;
            for (int i = 0; i < 10; i++) {
                min[i] = Math.min(d1[nine[i][0]], d2[nine[i][1]]);
                d1[nine[i][0]] -= min[i];
                d2[nine[i][1]] -= min[i];
            }
            for (int i = 1; i <= 9; i++) {
                for (int j = 1; j <= d1[i]; j++) {
                    pw.print(i);
                }
            }
            int m = Math.min(d1[0], d2[0]);
            for (int i = 1; i <= d1[0]-d2[0]; i++) {
                pw.print(0);
            }
            for (int i = 0; i < 10; i++) {
                for (int j = 1; j <= min[i]; j++) {
                    pw.print(nine[i][0]);
                }
            }
            pw.print(ten[k][0]);
            for (int i = 1; i <= m; i++) {
                pw.print(0);
            }
            pw.println();
            for (int i = 1; i <= 9; i++) {
                for (int j = 1; j <= d2[i]; j++) {
                    pw.print(i);
                }
            }
            for (int i = 1; i <= d2[0]-d1[0]; i++) {
                pw.print(0);
            }
            for (int i = 0; i < 10; i++) {
                for (int j = 1; j <= min[i]; j++) {
                    pw.print(nine[i][1]);
                }
            }
            pw.print(ten[k][1]);
            for (int i = 1; i <= m; i++) {
                pw.print(0);
            }
        }
        pw.close();
    }
}