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.*;
import java.math.*;
import java.util.*;
 
public class Main {
	static final long MOD = 1000000007L;
	static final int INF = 50000000;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		String N = sc.next();
		int[] cnt = new int[10];
		for (char c: N.toCharArray()) {
			cnt[c-'0'] += 1;
		}
		int maxZ = 0;
		int[] pair = new int[2];
		for (int i = 0; i <= cnt[0]; i++) {
			if (i > maxZ) {
				maxZ = i;
				pair = new int[] {i,-1};
			}
			for (int j = 1; j < 10; j++) {
				int k = 10-j;
				if (cnt[j]==0||cnt[k]==0)continue;
				int[] p1 = Arrays.copyOf(cnt, 10);
				p1[0] -= i;
				p1[j] -= 1;
				int[] p2 = Arrays.copyOf(cnt, 10);
				p2[0] -= i;
				p2[k] -= 1;
				int z = i+1;
				for (int d = 0; d < 10; d++) {
					z += Math.min(p1[d],p2[9-d]);
				}
				if (z > maxZ) {
					maxZ = z;
					pair = new int[] {i,j};
				}
			}
		}
		
		if (maxZ == 0) {
			pw.println(N);
			pw.println(N);
		} else if (pair[1] == -1) {
			StringBuilder s1 = new StringBuilder();
			StringBuilder s2 = new StringBuilder();
			for (char c: N.toCharArray()) {
				if (c!='0') {
					s1.append(c);
					s2.append(c);
				}
			}
			for (int i = 0; i < pair[0]; i++) {
				s1.append('0');
				s2.append('0');
			}
			pw.println(s1);
			pw.println(s2);
		} else {
			StringBuilder s1 = new StringBuilder();
			StringBuilder s2 = new StringBuilder();
			for (int i = 0; i < pair[0]; i++) {
				s1.append('0');
				s2.append('0');
			}
			s1.append(pair[1]);
			s2.append(10-pair[1]);
			int[] p1 = Arrays.copyOf(cnt, 10);
			p1[0] -= pair[0];
			p1[pair[1]] -= 1;
			int[] p2 = Arrays.copyOf(cnt, 10);
			p2[0] -= pair[0];
			p2[10-pair[1]] -= 1;
			for (int d = 0; d < 10; d++) {
				int c = Math.min(p1[d],p2[9-d]);
				for (int a = 0; a < c; a++) {
					s1.append(d);
					s2.append(9-d);
				}
				p1[d] -= c;
				p2[9-d] -= c;
			}
			for (int d = 0; d < 10; d++) {
				for (int a = 0; a < p1[d]; a++)
					s1.append(d);
				for (int a = 0; a < p2[d]; a++)
					s2.append(d);
			}
			s1 = s1.reverse();
			s2 = s2.reverse();
			pw.println(s1);
			pw.println(s2);
		}
		
		
		pw.close();
	}
	
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        }
        
        int ni() { 
            return Integer.parseInt(next()); 
        }
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() {
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str;
        }
    }
}