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.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

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

class TaskB {

    int[] count = new int[10];
    int[] countA = new int[10];
    int[] countB = new int[10];
    StringBuilder[] A = new StringBuilder[2];

    private void dodaj(int num, int what, int cnt) {
        while(cnt-->0) A[num].append(what);
    }

    private int countuj(int x) {
       for(int i=0; i<10; i++) {
           countA[i] = count[i];
           countB[i] = count[i];
       }

       if (countA[x] == 0 || countB[10-x] == 0) return Math.min(countA[0], countB[0]);

        countA[x]--;
        countB[10-x]--;



       int res = 1;
       for(int i=0; i<=9; i++) {
           int e = Math.min(countA[i], countB[9-i]);
           res += e;
           countA[i] -= e;
           countB[9-i] -= e;
       }

        res += Math.min(countA[0], countB[0]);

        return res;
    }

	public void solve(int testNumber, Scanner in, PrintWriter out) {
        String a = in.next();
        for(char c : a.toCharArray()) {
            count[c-'0']++;
        }
        A[0] = new StringBuilder();
        A[1] = new StringBuilder();

        int best = 1;
        int res = 0;
        for(int i=1; i<=5; i++) {
           int x = countuj(i);
            if (x > res) {
                res = x;
                best = i;
            }
        }

        for(int i=0; i<10; i++) {
           countA[i] = count[i];
           countB[i] = count[i];
       }

        if (countA[best] > 0 && countB[10 - best] > 0) {
            dodaj(0, best, 1);
            dodaj(1, 10 - best, 1);

            countA[best]--;
            countB[10-best]--;
        }

       for(int i=0; i<=9; i++){
           int e = Math.min(countA[i], countB[9-i]);
           dodaj(0, i, e);
           dodaj(1, 9-i, e);
           countA[i] -= e;
           countB[9-i] -= e;
       }



        int e =  Math.min(countA[0], countB[0]);
        countA[0] -= e;
        countB[0] -= e;

        for(int i=0; i<=9; i++) {
            dodaj(0, i, countA[i]);
            dodaj(1, i, countB[i]);
        }

        A[0] = new StringBuilder(A[0].reverse());
        A[1] = new StringBuilder(A[1].reverse());

            dodaj(0, 0, e);
            dodaj(1, 0, e);

        out.print(A[0].toString() + "\n" + A[1].toString());
	}
}