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:
/**
 * Created by IntelliJ IDEA.
 * User: jte
 * Date: 12/24/11
 * Time: 8:02 AM
 * To change this template use File | Settings | File Templates.
 */

import java.io.*;
import java.util.*;

public class TaskB extends Thread {
    public TaskB(int what) {
        try {
            if (what == 0) {
                this.input = new BufferedReader(new InputStreamReader(System.in));
                this.output = new PrintWriter(System.out);
            } else {
                this.input = new BufferedReader(new FileReader(INPUT_FILE));
                this.output = new PrintWriter(OUTPUT_FILE);
            }
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(666);
        }
    }

    private void solve() throws Throwable {
        int count [] = new int[10];
        char []number = nextToken().toCharArray();
        for (char c : number) {
            ++count[c - '0'];
        }
        int count2[] = count.clone();
        int result = 0;
        int best = -1;
        for (int first = 1; first <= 9; ++first) {
            if (count[first] < 1 || count2[10 - first] < 1) {
                continue;
            }
            int[] now = count.clone();
            int[] now2 = count2.clone();
            int currentScore = 1;
            --now[first];
              --now2[10 - first];
            for (int q = 0; q <= 9; ++q) {
                int t = Math.min(now[q], now2[9 - q]);
                currentScore += t;
                now[q] -= t;
                now2[9 - q] -= t;
            }
            currentScore += Math.min(now2[0], now[0]);
            if (currentScore > result) {
                result = currentScore;
                best = first;
            }
        }
        if (best == -1) {
            StringBuilder answer = new StringBuilder();
            for (int i = 0; i < 10; ++i) {
                while (count[i] != 0) {
                    answer.append(i);
                    --count[i];
                }
            }
            output.println(answer.reverse().toString());
            output.println(answer.toString());
            return;
        } else {
            StringBuilder first = new StringBuilder();
            StringBuilder second = new StringBuilder();
            first.append(best);
            second.append(10 - best);
            --count[best];
              --count2[10 - best];
            for (int q = 0; q <= 9; ++q) {
                int limit = Math.min(count[q], count2[9 - q]);
                for (int i = 0; i < limit; ++i) {
                    first.append(q);
                    second.append(9 - q);
                    --count[q];
                    --count2[9 - q];
                }
            }

            for (int i = 1; i < 10; ++i) {
                while (count[i] != 0) {
                    first.append(i);

                    --count[i];
                }
                while (count2[i] != 0) {
                    second.append(i);
                    --count2[i];
                }
            }
            int t = Math.min(count[0], count2[0]);
            for (int i = 0; i < count[0] - t; ++i) {
                first.append(0);
            }
            for (int i = 0; i < count2[0] - t; ++i) {
                second.append(0);
            }
            first.reverse();
            second.reverse();
            for (int i = 0; i < t; ++i) {
                first.append(0);
                second.append(0);
            }

            output.println(first.toString());
            output.println(second.toString());
        }
    }

    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(666);
        } finally {
            output.flush();
            output.close();
        }
    }


    public static void main(String... args) {
        new TaskB(0).start();
    }

    private String nextToken() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine());
        }
        return tokens.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private String INPUT_FILE = null;
    private String OUTPUT_FILE = null;
    private BufferedReader input;
    private PrintWriter output;
    private StringTokenizer tokens = null;
}