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;
const int maxN = 20, inf = 1000 * 1000 * 1000;
int i, n, ans, t, j, k, a[maxN], b[maxN], c[maxN], d[maxN], nul, h;
bool f;
string s;
int main() {
  getline(cin, s);
  n = s.length();
  for (i = 0; i < n; ++i) {
    ++a[s[i] - '0'];
  }
  j = 0;
  ans = 0;
  k = 0;
  for (i = 1; i <= 9; ++i) {
    for (j = 0; j < 10; ++j) {
      b[j] = a[j];
      c[j] = a[j];
    }
    t = 0;
    if (b[i] > 0 && c[10 - i] > 0) {
      --b[i];
      --c[10 - i];
      ++t;
      for (j = 0; j < 10; ++j) {
        t += min(b[j], c[9 - j]);
      }
      if (t > ans) {
        ans = t;
        k = i;
      }
    }
  }
  for (i = 0; i < 10; ++i) {
    b[i] = a[i];
    c[i] = a[i];
  }
  f = false;
  if (b[k] > 0 && c[10 - k] > 0) {
    --b[k];
    --c[10 - k];
    f = true;
  }
  h = min(c[0] - min(b[9], c[0]), b[0] - min(b[0], c[9]));
  for (i = 0; i < b[0] - h - min(b[0], c[9]); ++i) {
    cout << 0;
  }
  for (i = 1; i < 10; ++i) {
    for (j = 0; j < b[i] - min(b[i], c[9 - i]); ++j) {
      cout << i;
      ++d[i];
    }
  }
  for (i = 0; i < 10; ++i) {
    for (j = 0; j < min(b[i], c[9 - i]); ++j) {
      cout << i;
      ++d[i];
    }
  }
  if (f) {
    cout << k;
    ++d[k];
  }
  for (i = 0; i < h; ++i) {
    cout << 0;
    ++d[0];
  }
  cout << endl;
  for (i = 0; i < c[0] - h - min(b[9], c[0]); ++i) {
    cout << 0;
  }
  for (i = 1; i < 10; ++i) {
    for (j = 0; j < c[i] - min(b[9 - i], c[i]); ++j) {
      cout << i;
      --d[i];
    }
  }
  for (i = 9; i >= 0; --i) {
    for (j = 0; j < min(b[9 - i], c[i]); ++j) {
      cout << i;
      --d[i];
    }
  }
  if (f) {
    cout << 10 - k;
    --d[10 - k];
  }
  for (i = 0; i < h; ++i) {
    cout << 0;
    --d[0];
  }
  cout << endl;
  return 0;
}