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;
int br[10];
int rescnt[10];
int res = -1, first, last;
string x, y;
void scan() {
  while (scanf("%c", &ch) == 1) {
    if (ch >= '0' && ch <= '9') br[ch - '0']++;
  }
}
void slv(int f, int l) {
  int cntres = 0;
  int cur[10];
  memset(cur, 0, sizeof(cur));
  for (int i = 0; i <= 9; ++i) {
    cur[i] = min(br[i] - (i == f), br[9 - i] - (9 - i == l));
    if (cur[i] < 0) {
      cur[i] = 0;
      continue;
    }
    cntres += cur[i];
  }
  if (cntres > res) {
    res = cntres;
    for (int i = 0; i <= 9; ++i) rescnt[i] = cur[i];
    first = f;
    last = l;
  }
}
void solve() {
  for (int i = 1; i <= 5; ++i)
    if (br[i] && br[10 - i]) slv(i, 10 - i);
  if (res == -1) {
    for (int i = 9; i >= 0; --i)
      for (int j = 0; j < br[i]; ++j) printf("%d", i);
    printf("\n");
    for (int i = 9; i >= 0; --i)
      for (int j = 0; j < br[i]; ++j) printf("%d", i);
    printf("\n");
    return;
  }
  int brx[10], bry[10];
  for (int i = 0; i < 10; ++i) brx[i] = bry[i] = 0;
  brx[first]++;
  x += first;
  int tt = 0;
  int fuck = brx[9];
  for (int i = 0; i <= 9; ++i)
    for (int j = 0; j < rescnt[i]; ++j) {
      x += (char)i;
      brx[i]++;
    }
  for (int i = 1; i <= 9; ++i)
    for (; brx[i] < br[i]; ++brx[i]) x += (char)i;
  for (int i = 0; i < (rescnt[9] > rescnt[0]); ++i) {
    x += (char)0;
    brx[0]++;
  }
  reverse(x.begin(), x.end());
  for (brx[0]; brx[0] < br[0]; ++brx[0]) {
    x += (char)0;
    ++tt;
  }
  for (int i = 0; i < x.size(); ++i) printf("%d", x[i]);
  reverse(x.begin(), x.end());
  res = res + 1;
  int lamp = 0;
  for (int i = tt; i < tt + res; ++i) {
    if (!lamp) {
      lamp = 1;
      y += (10 - x[i]);
      bry[10 - x[i]]++;
    } else {
      y += (9 - x[i]);
      bry[9 - x[i]]++;
    }
  }
  for (int i = 1; i <= 9; ++i)
    for (; bry[i] < br[i]; ++bry[i]) y += (char)i;
  reverse(y.begin(), y.end());
  for (bry[0]; bry[0] < br[0]; ++bry[0]) y += (char)0;
  printf("\n");
  for (int i = 0; i < y.size(); ++i) printf("%d", y[i]);
  printf("\n");
}
int main() {
  scan();
  solve();
}