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 PYTHON):

Solution:
import sys


def d( digits ):
  pair9s = {}
  for i in range(10): pair9s[i] = 9 - i
  baseCounts = [0]*10

  for digit in digits: baseCounts[int(digit)] += 1


  iTen = -1
  mxZeros = 0
  for i in range(1,6):

    countsa = baseCounts[:]
    countsb = baseCounts[:]
    zeros=0
    i10 = 10 - i
    mn9s = [0]*10
    mni10 = min(1,countsa[i],countsb[i10])

    if mni10>0:
      countsa[i] -= 1
      countsb[i10] -= 1
      zeros = 1
      for j in range(10):
        j9 = pair9s[j]
        mn = min( countsa[j],countsb[j9])
        if mn>0:
          countsa[j] -= mn
          countsb[j9] -= mn
          zeros += mn
          mn9s[j] = mn

    mn0 = min(countsa[0],countsb[0])
    
    countsa[0] -= mn0
    countsb[0] -= mn0
    zeros += mn0

    if mxZeros < zeros:
      mxZeros = zeros
      mxZString = ['']*2
      for j in range(10):
         mxZString[0] += str(j) * countsa[j]
         mxZString[1] += str(j) * countsb[j]
      for j in range(10):
         mxZString[0] += str(j)*mn9s[j]
         mxZString[1] += str(9-j)*mn9s[j]
      mxZString[0] += str(i)*mni10 + '0' * mn0 
      mxZString[1] += str(i10)*mni10 + '0' * mn0 

  if mxZeros==0: return (digits,digits)

  return tuple(mxZString)

if __name__=="__main__":

  digits = sys.stdin.readline().strip('\n\r ')

  print( "%s\n%s" % d(digits) )