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;
char ch[100005], a[100005], b[100005];
int nin[10], ten[10];
int u[10], v[10], m;
int main() {
  int i, kk, m, cct;
  bool flag;
  while (gets(ch)) {
    kk = -1;
    m = 0;
    memset(u, 0, sizeof(u));
    for (i = 0; ch[i]; ++i) ++u[ch[i] - '0'];
    memcpy(v, u, sizeof(u));
    for (i = 1; i <= 4; ++i) {
      nin[9 - i] = nin[i] = min(u[i], u[9 - i]);
      ten[10 - i] = ten[i] = min(u[i], u[10 - i]);
    }
    nin[0] = nin[9] = min(u[0], u[9]);
    ten[5] = u[5];
    flag = false;
    for (i = 1; i <= 5; ++i)
      if (ten[i] > 0) {
        flag = true;
        break;
      }
    if (!flag || !nin[9]) {
      for (i = 0; i < u[0]; ++i) a[i] = b[i] = '0';
      m = u[0];
      u[0] = v[0] = 0;
      nin[9] = nin[0] = 0;
    }
    if (u[0] > nin[0]) {
      cct = u[0] - nin[0];
      u[0] -= cct;
      v[0] -= cct;
      while (cct--) {
        a[m] = b[m] = '0';
        ++m;
      }
    }
    flag = false;
    for (i = 1; i <= 9; ++i)
      if (ten[i] > 0) {
        if (nin[i] < u[i] && nin[10 - i] < u[10 - i]) {
          kk = i;
          break;
        } else if (nin[i] < u[i] || nin[10 - i] < u[10 - i]) {
          kk = i;
          flag = true;
        }
        if (!flag) kk = i;
      }
    if (kk != -1) {
      if (i == 10) {
        if (!flag) {
          --nin[kk];
          --nin[kk - 1];
        } else if (nin[kk] < u[kk])
          --nin[kk - 1];
        else
          --nin[kk];
      }
      --u[kk];
      --v[10 - kk];
      a[m] = kk + '0';
      b[m] = 10 - kk + '0';
      ++m;
      for (i = 0; i <= 9; ++i)
        if (nin[i] > 0) {
          cct = nin[i];
          while (cct--) {
            a[m] = i + '0';
            b[m] = 9 - i + '0';
            ++m;
            --u[i];
            --v[9 - i];
          }
        }
    }
    cct = m;
    for (i = 0; i <= 9; ++i)
      while (u[i] > 0 && u[i]--) a[m++] = i + '0';
    for (i = 0; i <= 9; ++i)
      while (v[i] > 0 && v[i]--) b[cct++] = i + '0';
    for (i = m - 1; i >= 0; --i) putchar(a[i]);
    putchar('\n');
    for (i = m - 1; i >= 0; --i) putchar(b[i]);
    putchar('\n');
  }
}