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;
const int MAXN = 200 * 1000;
char s[MAXN];
int c[10], c1[10], c2[10];
char s1[MAXN], s2[MAXN];
int getValue(int z, int A) {
  for (int i = 0; i < 10; ++i) c1[i] = c2[i] = c[i];
  c1[0] -= z;
  c2[0] -= z;
  int ans = z + 1;
  c1[A]--;
  c2[10 - A]--;
  for (int i = 0; i < 10; ++i) ans += min(c1[i], c2[9 - i]);
  return ans;
}
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; ++i) c[s[i] - '0']++;
  int opt_ans = -1;
  int opt_zero = 0;
  int opt_first_digit = 0;
  for (int i = 0; i <= c[0]; ++i)
    for (int A = 1; A <= 9; ++A)
      if (c[A] > 0 && c[10 - A] > 0) {
        int y = getValue(i, A);
        if (opt_ans < y) {
          opt_ans = y;
          opt_zero = i;
          opt_first_digit = A;
        }
      }
  s1[n] = s2[n] = 0;
  if (opt_ans == -1) {
    sort(s, s + n);
    reverse(s, s + n);
    printf("%s\n%s\n", s, s);
    return 0;
  }
  for (int i = 0; i < 10; ++i) c1[i] = c2[i] = c[i];
  int u = 0;
  for (int i = 0; i < opt_zero; ++i) {
    s1[u] = s2[u] = '0';
    ++u;
    c1[0]--;
    c2[0]--;
  }
  s1[u] = '0' + opt_first_digit;
  s2[u] = '0' + 10 - opt_first_digit;
  ++u;
  c1[opt_first_digit]--;
  c2[10 - opt_first_digit]--;
  for (int i = 0; i < 10; ++i) {
    while (c1[i] > 0 && c2[9 - i] > 0) {
      --c1[i];
      --c2[9 - i];
      s1[u] = '0' + i;
      s2[u] = '0' + 9 - i;
      ++u;
    }
  }
  int u1 = u;
  for (int i = 0; i < 10; ++i) {
    while (c1[i] > 0) {
      s1[u1] = i + '0';
      --c1[i];
      ++u1;
    }
  }
  for (int i = 0; i < 10; ++i) {
    while (c2[i] > 0) {
      s2[u] = i + '0';
      --c2[i];
      ++u;
    }
  }
  int l = 0;
  int r = n - 1;
  while (l < r) {
    char t = s1[l];
    s1[l] = s1[r];
    s1[r] = t;
    t = s2[l];
    s2[l] = s2[r];
    s2[r] = t;
    ++l;
    --r;
  }
  printf("%s\n%s\n", s1, s2);
  return 0;
}