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
#include <bits/stdc++.h>
using namespace std;
long long int wari(long long int a, long long int b) {
  long long int res = (long long int)a / b;
  if (a % b != 0) res++;
  return res;
}
bool vow(char a) {
  if (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
    return true;
  else
    return false;
}
bool rsm(string a, string b, long long int k) {
  long long int aa = ((long long int)(a).size()),
                bb = ((long long int)(b).size());
  long long int count = 0;
  for (long long int i = 1; i < min(aa, bb) + 1; i++) {
    if (a[aa - i] != b[bb - i]) break;
    if (vow(a[aa - i])) count++;
    if (count >= k) return true;
  }
  return false;
}
long long int num(vector<int> a) {
  long long int res = 0;
  long long int n = ((long long int)(a).size());
  for (long long int i = 0; i < ((long long int)(n)); i++) {
    res += a[i];
    res *= 10;
  }
  return res / 10;
}
int ju(long long int a) {
  if (a % 100000 == 0) return 5;
  if (a % 10000 == 0) return 4;
  if (a % 1000 == 0) return 3;
  if (a % 100 == 0) return 2;
  if (a % 10 == 0)
    return 1;
  else
    return 0;
}
int keta(long long int a) {
  if (a / 100000) return 6;
  if (a / 10000) return 5;
  if (a / 1000) return 4;
  if (a / 100) return 3;
  if (a / 10)
    return 2;
  else
    return 1;
}
int aatoi(char a) { return a - '0'; }
void print_num(long long int a, long long int b) {
  long long int ju = 1;
  long long int n = b;
  for (long long int i = (long long int)(1); i < ((long long int)(b)); i++) {
    ju *= 10;
  }
  while (n-- > 0) {
    cout << a / ju;
    a %= ju;
    ju /= 10;
  }
  puts("");
  return;
}
void acp(long long int a[], long long int b[], long long int n) {
  for (long long int i = 0; i < ((long long int)(n)); i++) a[i] = b[i];
  return;
}
long long int max9(long long int a[], long long int num) {
  long long int b[10];
  long long int res = 0, cd;
  acp(b, a, 10);
  a[num + 1]--;
  b[9 - num]--;
  for (long long int i = 0; i < ((long long int)(10)); i++) {
    cd = min(a[i], b[9 - i]);
    if (cd > 0) {
      res += cd;
      a[i] -= cd;
      b[9 - i] -= cd;
    }
  }
  return res;
}
int main() {
  long long int count[10] = {0}, tmp[10];
  long long int res = 0, rr, cd, now;
  string in;
  cin >> in;
  long long int n = ((long long int)(in).size());
  long long int ii = -1, jj = 0;
  short a[100000] = {0}, b[100000] = {0};
  for (long long int i = 0; i < ((long long int)(n)); i++) {
    count[aatoi(in[i])]++;
  }
  for (long long int i = 0; i < ((long long int)(5)); i++) {
    if (count[i + 1] == 0 || count[9 - i] == 0)
      ;
    else {
      for (long long int j = 0;
           j < ((long long int)(min(count[0], count[9]) + 1)); j++) {
        acp(tmp, count, 10);
        rr = 1;
        rr += tmp[0] - j;
        tmp[0] = j;
        rr += max9(tmp, i);
        if (rr > res) {
          ii = i;
          jj = j;
          res = rr;
        }
      }
    }
  }
  acp(tmp, count, 10);
  if (res != 0) {
    for (long long int i = 0; i < ((long long int)(count[0] - jj)); i++) {
      a[n - i] = 0;
      b[n - i] = 0;
    }
    a[n - count[0] + jj - 1] = ii + 1;
    b[n - count[0] + jj - 1] = 9 - ii;
    now = n - count[0] + jj - 2;
    tmp[0] = jj;
    count[0] = jj;
    tmp[ii + 1]--;
    count[9 - ii]--;
    for (long long int i = 0; i < ((long long int)(10)); i++) {
      cd = min(tmp[i], count[9 - i]);
      if (cd > 0) {
        for (long long int j = 0; j < ((long long int)(cd)); j++) {
          a[now] = i;
          b[now] = 9 - i;
          now--;
        }
        tmp[i] -= cd;
        count[9 - i] -= cd;
      }
    }
  }
  now = 0;
  for (long long int i = 0; i < ((long long int)(10)); i++) {
    if (tmp[9 - i] > 0) {
      for (long long int j = 0; j < ((long long int)(tmp[9 - i])); j++) {
        a[now] = 9 - i;
        now++;
      }
      tmp[9 - i] = 0;
    }
  }
  now = 0;
  for (long long int i = 0; i < ((long long int)(10)); i++) {
    if (count[9 - i] > 0) {
      for (long long int j = 0; j < ((long long int)(count[9 - i])); j++) {
        b[now] = 9 - i;
        now++;
      }
      count[9 - i] = 0;
    }
  }
  for (long long int i = 0; i < ((long long int)(n)); i++) cout << a[i];
  puts("");
  for (long long int i = 0; i < ((long long int)(n)); i++) cout << b[i];
  puts("");
  return 0;
}
