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 a[100005];
int fir[10];
int sec[10];
int en[10];
char res1[100005];
char res2[100005];
int main() {
  scanf("%s", &a);
  int i;
  int l, j;
  for (i = 0; a[i]; i++) fir[a[i] - '0']++;
  l = i;
  for (i = 0; i < 10; i++) sec[i] = fir[i];
  int ma = 0;
  int di = -1;
  ma = fir[0];
  en[0] = ma;
  for (i = 1; i <= 9; i++) {
    int b[10], c[10];
    for (j = 0; j <= 9; j++) b[j] = c[j] = fir[j];
    int k = 10 - i;
    int ans = 0, mi;
    if (b[i] && c[k]) {
      b[i]--;
      c[k]--;
      ans = 1;
      for (j = 0; j <= 9; j++) {
        mi = min(b[j], c[9 - j]);
        ans += mi;
        b[j] -= mi;
        c[9 - j] -= mi;
      }
    }
    mi = min(b[0], c[0]);
    en[i] = mi;
    ans += mi;
    if (ans > ma) {
      ma = ans;
      di = i;
    }
  }
  int last = l - 1;
  strcpy(res1, a);
  strcpy(res2, a);
  if (di != -1) {
    while (en[di]) {
      res1[last] = '0';
      res2[last] = '0';
      last--;
      en[di]--;
      fir[0]--;
      sec[0]--;
    }
    res1[last] = di + '0';
    res2[last] = (10 - di) + '0';
    last--;
    fir[di]--;
    sec[10 - di]--;
    for (j = 0; j <= 9; j++) {
      int mi = min(fir[j], sec[9 - j]);
      fir[j] -= mi;
      sec[9 - j] -= mi;
      while (mi) {
        res1[last] = j + '0';
        res2[last] = 9 - j + '0';
        last--;
        mi--;
      }
    }
    for (i = 0; i <= last; i++) {
      int d1, d2;
      d1 = 0;
      d2 = 0;
      for (j = 0; j < 10; j++) {
        if (fir[j] > 0 && d1 == 0) {
          fir[j]--;
          res1[i] = j + '0';
          d1 = 1;
        }
        if (sec[j] > 0 && d2 == 0) {
          d2 = 1;
          sec[j]--;
          res2[i] = j + '0';
        }
      }
    }
    printf("%s\n", res1);
    printf("%s\n", res2);
  } else {
    strcpy(res1, a);
    strcpy(res2, a);
    sort(res1, res1 + l);
    sort(res2, res2 + l);
    reverse(res1, res1 + l);
    reverse(res2, res2 + l);
    printf("%s\n", res1);
    printf("%s\n", res2);
  }
}