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>
int c[10];
char s[100010];
char a[2][100010];
int d[2][10];
void debug(int f[], int n) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%d ", f[i]);
  }
  printf("\n");
}
void solve() {
  int len, i, j, k, t, mins, count, ans, num, zeros;
  len = strlen(s);
  memset(c, 0, sizeof(c));
  for (i = 0; i < len; i++) {
    c[s[i] - '0']++;
  }
  ans = 0;
  zeros = num = -1;
  for (i = 1; i <= 5; i++) {
    memcpy(d[0], c, sizeof(c));
    memcpy(d[1], c, sizeof(c));
    if (d[0][i] > 0 && d[1][10 - i] > 0) {
      count = 1;
      d[0][i]--;
      d[1][10 - i]--;
      for (j = 0; j <= 9; j++) {
        mins = ((d[0][j]) < (d[1][9 - j]) ? (d[0][j]) : (d[1][9 - j]));
        d[0][j] -= mins;
        d[1][9 - j] -= mins;
        count += mins;
      }
      mins = ((d[0][0]) < (d[1][0]) ? (d[0][0]) : (d[1][0]));
      count += mins;
      if (count > ans) {
        zeros = mins;
        ans = count;
        num = i;
      }
    }
  }
  a[0][len] = a[1][len] = '\0';
  for (i = len - 1, j = 0; i >= 0 && j < zeros; i--, j++) {
    a[0][i] = a[1][i] = '0';
  }
  if (i >= 0) {
    memcpy(d[0], c, sizeof(c));
    memcpy(d[1], c, sizeof(c));
    if (num != -1) {
      d[0][0] -= zeros;
      d[1][0] -= zeros;
      a[0][i] = num + '0';
      a[1][i] = 10 - num + '0';
      d[0][num]--;
      d[1][10 - num]--;
      i--;
      for (j = 0; i >= 0 && j <= 9; j++) {
        mins = ((d[0][j]) < (d[1][9 - j]) ? (d[0][j]) : (d[1][9 - j]));
        d[0][j] -= mins;
        d[1][9 - j] -= mins;
        for (k = 0; i >= 0 && k < mins; k++) {
          a[0][i] = j + '0';
          a[1][i] = 9 - j + '0';
          i--;
        }
      }
    }
    k = t = i;
    for (j = 0; (k >= 0 || t >= 0) && j <= 9; j++) {
      while (k >= 0 && d[0][j] != 0) {
        a[0][k--] = j + '0';
        d[0][j]--;
      }
      while (t >= 0 && d[1][j] != 0) {
        a[1][t--] = j + '0';
        d[1][j]--;
      }
    }
  }
  printf("%s\n%s\n", a[0], a[1]);
}
int main() {
  while (scanf("%s", s) == 1) {
    solve();
  }
  return 0;
}