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.lang.*;
import java.awt.geom.Line2D;
import java.io.*;
import java.util.*;
import java.math.*;

public class B implements Runnable{
    
    public void run() { 
        char[] c = nextLine().toCharArray();
        int n = c.length;
        int[] cnt = new int[10];
        for (int i = 0; i < n; ++i) {
            ++cnt[(int)(c[i]- '0')];
        }
        
        String ans1 = "";
        String ans2 = "";
        int maxc = -1;
        int[] cc = cnt.clone();
        for (int i = 1; i < 10; ++i) {
            //if (cnt[i] > 0 && cnt[10-i] > 0) {
                LinkedList<Integer> tmp1 = new LinkedList<Integer>();
                LinkedList<Integer> tmp2 = new LinkedList<Integer>();
                int[] cnt1 = cnt.clone();
                
                int cur = 0;
                boolean countTen = false;
                if (cnt[i] > 0 && cnt1[10-i] > 0) {
                    tmp1.addLast(i);
                    tmp2.addLast(10-i);             
                    --cnt[i];
                    --cnt1[10-i];
                    countTen = true;
                    ++cur;
                }
                
                
                for (int j = 0; j < 10; ++j) {
                    while (cnt[j] > 0 && cnt1[9-j] > 0) {
                        tmp1.addFirst(j);
                        tmp2.addFirst(9-j);
                        --cnt[j];
                        --cnt1[9-j];
                        if (countTen) {
                            ++cur;
                        }
                    }
                }
                
                for (int j = 0; j < Math.min(cnt[0], cnt1[0]); ++j) {
                    tmp1.addLast(0);
                    tmp2.addLast(0);
                    ++cur;
                }
                int sub = Math.min(cnt[0], cnt1[0]);
                cnt[0] -= sub;
                cnt1[0] -= sub;
                
                int pos = tmp1.size();
                int p1 = 0;
                int p2 = 0;
                while (pos < n) {
                    while(p1 < 10 && cnt[p1] == 0) {
                        ++p1;
                    }
                    while(p2 < 10 && cnt1[p2] == 0) {
                        ++p2;
                    }
                    if (p1 < 10 && p2 < 10 && cnt[p1] > 0 && cnt1[p2] > 0) {
                        tmp1.addFirst(p1);
                        tmp2.addFirst(p2);
                        --cnt[p1];
                        --cnt1[p2];
                        ++pos;
                    }
                    
                    if (p1 == 10 && p2 == 10) {
                        break;
                    }
                }
                
                
                
                StringBuilder a1 = new StringBuilder();
                StringBuilder a2 = new StringBuilder();
                for (int j = 0; j < n; ++j) {
                    int c1 = tmp1.removeFirst();
                    int c2 = tmp2.removeFirst();
                    a1.append(c1);
                    a2.append(c2);
                }
                
                String aa1 = a1.toString();
                String aa2 = a2.toString();
                //BigInteger n1 = new BigInteger(aa1);
                //BigInteger n2 = new BigInteger(aa2);
                //String sum = (n1.add(n2)).toString();
                //for (int j = sum.length()-1; j >= 0; --j) {
                //  if (sum.charAt(j) != '0') {
                //      break;
                //  }
                //  else {
                //      ++cur;
                //  }
                //}
                
                if (cur > maxc) {
                    ans1 = aa1;
                    ans2 = aa2;
                    maxc = cur;
                }
                cnt = cc.clone();
            //}
        }
        
        
        
        
        out.println(ans1);
        out.println(ans2);
        out.flush();
    }
    
    private static BufferedReader br = null;
    private static PrintWriter out = null;
    private static StringTokenizer stk = null;
    
    public static void main(String[] args) {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        (new Thread(new B())).start();
    }
    
    private void loadLine() {
        try {
            stk = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    private String nextLine() {
        try {
            return br.readLine();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    
    private Integer nextInt() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Integer.parseInt(stk.nextToken());
    }
    
    private Long nextLong() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Long.parseLong(stk.nextToken());
    }
    
    private String nextWord() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return (stk.nextToken());
    }
    
    private Double nextDouble() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Double.parseDouble(stk.nextToken());
    }
}