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 s[1000000];
int c[10], zero;
vector<char> a, b;
int zz = 0;
int e[10], g[10];
int res = 0;
int tot = 0;
void check(int x) {
  int i, j, l, o, d[10], f[10];
  vector<char> u, v;
  if (c[x] == 0 || c[10 - x] == 0) return;
  tot++;
  {};
  memcpy(d, c, sizeof(c));
  memcpy(f, c, sizeof(c));
  u.push_back(x + '0');
  v.push_back((10 - x) + '0');
  d[x]--;
  f[10 - x]--;
  int r = 1;
  int bw = -1, bt = -1, t;
  for (t = 0; t <= d[0] && t <= f[0]; t++) {
    int x0 = d[0] - t, y0 = f[0] - t, x9 = d[9], y9 = f[9], w = t;
    w += min<int>(x0, y9) + min<int>(y0, x9);
    if (bw < w) {
      bw = w;
      bt = t;
    }
  }
  d[0] -= bt;
  f[0] -= bt;
  r += bt;
  for (i = 0; i <= 9; i++) {
    int j = 9 - i;
    o = d[i];
    if (o > f[j]) o = f[j];
    for (l = 0; l < o; l++) {
      d[i]--;
      f[j]--;
      u.push_back(i + '0');
      v.push_back(j + '0');
      r++;
    }
  }
  {};
  if (res < r) {
    res = r;
    a.swap(u);
    b.swap(v);
    memcpy(e, d, sizeof(d));
    memcpy(g, f, sizeof(f));
    zz = bt;
  }
}
void p(vector<char> a, int h[10]) {
  int i, j;
  for (i = 0; i < 10; i++) {
    for (j = 0; j < h[i]; j++) {
      putchar(i + '0');
    }
  }
  for (i = res - zz - 1; i >= 0; i--) {
    putchar(a[i]);
  }
  for (i = 0; i < zz; i++) putchar('0');
  putchar('\n');
}
int main(void) {
  int i, j, k;
  scanf("%s", s);
  memset(c, 0, sizeof(c));
  for (i = 0; s[i]; i++) {
    c[s[i] - '0']++;
  }
  for (i = 0; i < 10; i++) {
  };
  memcpy(e, c, sizeof(c));
  memcpy(g, c, sizeof(c));
  for (i = 1; i <= 5; i++) {
    check(i);
  }
  if (tot == 0) {
    zz = c[0];
    c[0] -= zz;
    memcpy(e, c, sizeof(c));
    memcpy(g, c, sizeof(c));
    res = zz;
  }
  p(a, e);
  p(b, g);
  return 0;
}