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.util.*;

public class B {

	public B () throws IOException {
		String N = sc.next();
		solve(N);
	}
	
	public void solve (String N) {
		t = millis();
		
		int [] D = new int [10];
		int L = N.length();

		for (char c : N.toCharArray())
			++D[c-'0'];
		
		int ZZ = D[0];
		int MAX = -1, mz = -1, mm = -1;
		
		for (int z = 0; z <= ZZ; ++z) {
			for (int m = 1; m <= 9; ++m) {
				int [] EX = new int [10];
				int [] EY = new int [10];
				for (int i = 0; i < 10; ++i) {
					EX[i] = D[i];
					EY[i] = D[i];
				}
				
				int M = 0;
				
				EX[0] -= z;
				EY[0] -= z;
				M += z;
				
				if (EX[m] > 0 && EY[10-m] > 0) {
					--EX[m];
					--EY[10-m];
					++M;
					for (int n = 0; n <= 9; ++n)
						M += Math.min(EX[n], EY[9-n]);
				}
				
				if (M > MAX) {
					MAX = M; mz = z; mm = m;
				}
			}
		}
		
		int [] X = new int [L];
		int [] Y = new int [L];
		int x = L-1, y = L-1;
		
		int [] DX = new int [10];
		int [] DY = new int [10];
		for (int i = 0; i < 10; ++i) {
			DX[i] = D[i];
			DY[i] = D[i];
		}
		
		for (int i = 0; i < mz; ++i) {
			X[x--] = 0; --DX[0];
			Y[y--] = 0; --DY[0];
		}
		
		if (DX[mm] > 0 && DY[10-mm] > 0) {
			X[x--] = mm; --DX[mm];
			Y[y--] = 10-mm; --DY[10-mm];
			
			for (int n = 0; n <= 9; ++n) {
				while (DX[n] > 0 && DY[9-n] > 0) {
					X[x--] = n; --DX[n];
					Y[y--] = 9-n; --DY[9-n];
				}
			}
		}
		
		for (int i = 0; i < 10; ++i) {
			for (int j = 0; j < DX[i]; ++j)
				X[x--] = i;
			for (int j = 0; j < DY[i]; ++j)
				Y[y--] = i;
		}
			
		char [] XX = new char[L];
		char [] YY = new char[L];
		
		for (int i = 0; i < L; ++i) {
			XX[i] = (char)(X[i] + '0');
			YY[i] = (char)(Y[i] + '0');
		}
		
		print2(new String(XX));
		print(new String(YY));
	}
	
	////////////////////////////////////////////////////////////////////////////////////

	static Scanner sc;
	static long t;
	
	static void print2 (Object o) {
		System.out.println(o);
	}
	
	static void print (Object o) {
		print2(o);
		//print2((millis() - t) / 1000.0);
		System.exit(0);
	}
	
	static void run () throws IOException {
		sc = new Scanner(System.in);
		new B();
	}
	
	public static void main(String[] args) throws IOException {
		run();
	}
	
	static long millis() {
		return System.currentTimeMillis();
	}
}