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.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class B {
	static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static long next() throws Exception {in.nextToken(); return (long) in.nval;}
//	static BufferedReader in;
	static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

        String s = new String(in.next());

        int a[] = new int[10];
        Arrays.fill(a, 0);
        int n = s.length();
        for (int i = 0;i < n;i++) a[s.charAt(i)-'0']++;
        int res = 0, best = 0;
        for (int i = 1;i <=5;i++) {
            int counter = 0;
            int b[] = a.clone();
            int c[] = a.clone();
            if (b[i] > 0 && c[10-i] > 0) {
                b[i]--;
                c[10-i]--;
                counter++;
                for (int j = 0;j < 10;j++) {
                    counter += Math.min(b[j],c[9-j]);
                    b[j] -= Math.min(b[j],c[9-j]);
                    c[9-j] -= Math.min(b[j],c[9-j]);
                }
            }
            counter += Math.min(b[0], c[0]);
     //       out.println(counter);
            if (counter >= res) {
                res = counter;
                best = i;
            }
        }

        int pairA[] = new int[n];
        int pairB[] = new int[n];
        int z = n-1;

        int b[] = a.clone();
        int c[] = a.clone();
        if (b[best] > 0 && c[10-best] > 0) {
            b[best]--;
            c[10-best]--;
            pairA[z] = best;
            pairB[z] = 10-best;
            z--;
            for (int j = 0;j < 10;j++) {
                for (int u = 0;b[j]>0&&c[9-j]>0;u++){
                    pairA[z] = j;
                    b[j]--;
                    pairB[z] = 9-j;
                    c[9-j]--;
                    z--;
                }
            }
            int sum1 = 0;
            for (int i = 1;i < 10;i++) {
                sum1 += b[i];
            }
            int sum2 = 0;

            for (int i = 1;i < 10;i++) {
                sum2+=c[i];
            }
            for (int i = 1;i < 10;i++) {
                while (b[i] > 0) {
                    out.print(i);
                    b[i]--;
                }
            }
            if (sum1 < sum2) {
                for (int i = sum1;i < sum2;i++)
                    b[0]--;
                out.print(0);
            }
            for (int i = z+1;i < n;i++) out.print(pairA[i]);
            for (int i = 0;i < b[0];i++) out.print(0);
            out.println();

            for (int i = 1;i < 10;i++) {
                while (c[i] > 0) {
                    out.print(i);
                    c[i]--;
                }
            }

            if (sum1 > sum2) {
                for (int i = sum2;i < sum1;i++)
                    c[0]--;
                out.print(0);
            }
            for (int i = z+1;i < n;i++) out.print(pairB[i]);
            for (int i = 0;i < c[0];i++) out.print(0);
            out.println();
        } else {
            char g[] = s.toCharArray();
            Arrays.sort(g);
            for (int i = n-1;i >= 0;i--) out.print(g[i]);
            out.println();

            for (int i = n-1;i >= 0;i--) out.print(g[i]);
        }


       // out.println(res);


        out.println();
		out.close();
	}
}