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

Solution:
#include <bits/stdc++.h>
using namespace std;
int a[10] = {}, b[10] = {}, org[10] = {};
char res1[200000] = {}, res2[200000] = {};
int main() {
  char c;
  while (cin >> c) ++a[c - '0'];
  int l = 0;
  for (int i = 0; i < 10; ++i) b[i] = a[i], l += a[i], org[i] = a[i];
  int m_first, m_zeros, MAX = 0;
  ++a[0], ++b[0];
  for (int z = 0; a[0] >= 0; ++z) {
    --a[0];
    --b[0];
    for (int i = 5; i < 10; ++i) {
      --a[i], --b[10 - i];
      int cur = 1;
      if (a[i] >= 0 && b[10 - i] >= 0) {
        cur += min(a[9], b[0]);
        cur += min(a[8], b[1]);
        cur += min(a[7], b[2]);
        cur += min(a[6], b[3]);
        cur += min(a[5], b[4]);
        cur += min(a[4], b[5]);
        cur += min(a[3], b[6]);
        cur += min(a[2], b[7]);
        cur += min(a[1], b[8]);
        cur += min(a[0], b[9]);
        if (cur + z > MAX) {
          MAX = cur + z;
          m_first = i;
          m_zeros = z;
        }
      }
      ++a[i], ++b[10 - i];
    }
  }
  if (MAX == 0 && org[0] > 0) {
    for (int i = 1; i < 10; ++i)
      for (int j = 0; j < a[i]; ++j) cout << char(i + '0');
    for (int j = 0; j < org[0]; ++j) cout << '0';
    cout << endl;
    for (int i = 1; i < 10; ++i)
      for (int j = 0; j < a[i]; ++j) cout << char(i + '0');
    for (int j = 0; j < org[0]; ++j) cout << '0';
    return 0;
  }
  if (MAX == 0) {
    for (int i = 0; i < 10; ++i)
      for (int j = 0; j < a[i]; ++j) cout << char(i + '0');
    cout << endl;
    for (int i = 0; i < 10; ++i)
      for (int j = 0; j < a[i]; ++j) cout << char(i + '0');
    return 0;
  }
  for (int i = 0; i < 10; ++i) a[i] = org[i];
  for (int i = 0; i < 10; ++i) b[i] = org[i];
  for (int i = 0; i < m_zeros; ++i) {
    res1[l - i - 1] = '0';
    res2[l - i - 1] = '0';
    --a[0], --b[0];
  }
  res1[l - m_zeros - 1] = m_first + '0';
  res2[l - m_zeros - 1] = 10 - m_first + '0';
  --a[m_first], --b[10 - m_first];
  int cur_pos = l - m_zeros - 1;
  for (int i = 0; i < 10; ++i)
    for (int j = 0; min(a[i], b[9 - i]) > 0; ++j)
      --cur_pos, res1[cur_pos] = i + '0', res2[cur_pos] = 9 - i + '0', --a[i],
                 --b[9 - i];
  int n1 = 0, n2 = 0;
  for (int i = 0; i < cur_pos; ++i) {
    while (a[n1] <= 0) ++n1;
    while (b[n2] <= 0) ++n2;
    res1[i] = n1 + '0';
    res2[i] = n2 + '0';
    --a[n1];
    --b[n2];
  }
  cout << res1 << endl << res2;
  return 0;
}