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

import static java.lang.Math.* ;
import static java.util.Arrays.* ;

public class B {
	
	public static void main(String[] args) throws IOException {
		
		new B().solveProblem();
		
		out.close();
	}

	static Scanner in = new Scanner(new InputStreamReader(System.in));
	//static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	static PrintStream out = new PrintStream(new BufferedOutputStream(System.out));
	
	
	public void solveProblem() {		
		char[] c = in.nextLine().toCharArray() ;
		
		int[] a = new int[10] ;
		for( char cc : c)
			a[cc-'0']++ ;
			
		int[] b = a.clone() ;
		
		
	
		
		for( int i = 5 ; i <= 9  ; i++ ){
			if( a[i] >0 && a[10-i]>0){
				a[i]-- ;
				b[10-i]-- ;
				probeer(""+i,""+(10-i),a.clone(),b.clone()) ;
				a[i]++ ;
				b[10-i]++ ;				
			}
		}

		if( o1.equals("")){
			probeer("","",a.clone(),b.clone()) ;
		}
		
		out.println(o1);
		out.println(o2);
		
		
	}
	
	void probeer(String aa, String bb, int[] a, int[] b){
		
		int nullen = 0 ;
		StringBuilder s1 = new StringBuilder(a.length)  ;
		StringBuilder s2 = new StringBuilder(b.length)  ;	
		
		
		for( int i = 0 ; i <= 9 ; i++ ){
			while( a[i] > 0 && b[9-i] > 0 ){
				a[i]-- ;
				b[9-i]-- ;
				s1.append( i) ;
				s2.append( 9-i) ;
				nullen++ ;
			}
		}
		
		for( int i = 1 ; i <= 9 ; i++ ){
			while( a[i] > 0 ){
				s1.append( i) ;
				a[i]-- ;
			}
			while( b[i] > 0 ){
				s2.append( i) ;
				b[i]-- ;
			}
		}
		
		s1.reverse() ;
		s2.reverse() ;
		
		s1.append(aa);
		s2.append(bb);
		
		while( a[0] > 0 && b[0] > 0){
			a[0]-- ;
			b[0]-- ;
			s1.append(0);
			s2.append(0);
		}
		
		while( a[0] > 0 ){
			a[0]-- ;
			s1.insert(0,0) ;
		}
		while( b[0] > 0 ){
			b[0]-- ;
			s2.insert(0,0) ;
		}
		
		if( nullen >= nn){
			nn = nullen ;
			o1 = s1.toString() ;
			o2 = s2.toString() ;
		}
	}
	

	String o1 = "" ;
	String o2 = "" ;
	int nn = 0 ;

	static int[] readGet( int n ){
	  	int[] get = new int[n] ;
	  	for( int i = 0 ; i < n ; i++ )
	  		get[i] = in.nextInt();
	  	return get ;
	}
	
}