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;
int main() {
  string s;
  int a[10];
  cin >> s;
  memset(a, 0, sizeof(a));
  for (int i = (0); (i) < (s.length()); (i)++) a[int(s[i]) - 48]++;
  int k = 0, l = 0, m = 0;
  for (int i = (1); (i) < (5); (i)++) k += min(a[i], a[10 - i]);
  k += a[5];
  for (int i = (1); (i) < (5); (i)++) l += min(a[i], a[9 - i]);
  m = min(a[0], a[9]);
  if (k == 0) {
    for (int j = (1); (j) < (10); (j)++)
      for (int t = (0); (t) < (a[j]); (t)++) cout << j;
    for (int t = (0); (t) < (a[0]); (t)++) cout << 0;
    cout << endl;
    for (int j = (1); (j) < (10); (j)++)
      for (int t = (0); (t) < (a[j]); (t)++) cout << j;
    for (int t = (0); (t) < (a[0]); (t)++) cout << 0;
    cout << endl;
    return 0;
  }
  int mm = -1;
  int d = 0;
  for (int j = (1); (j) < (6); (j)++) {
    int a1[10], a2[10];
    for (int i = (0); (i) < (10); (i)++) {
      a1[i] = a[i];
      a2[i] = a[i];
    }
    if (a[j] == 0 || a[10 - j] == 0) continue;
    a1[j]--;
    a2[10 - j]--;
    int m = 0;
    for (int t = (0); (t) < (10); (t)++) m += min(a1[t], a2[9 - t]);
    m += max(a[0] - a[9], 0);
    if (m > mm) {
      mm = m;
      d = j;
    }
  }
  int a1[10], a2[10];
  for (int i = (0); (i) < (10); (i)++) {
    a1[i] = a[i];
    a2[i] = a[i];
  }
  a1[d]--;
  a2[10 - d]--;
  vector<int> r1, r2;
  for (int i = (0); (i) < (max(a[0] - a[9], 0)); (i)++) {
    r1.push_back(0);
    r2.push_back(0);
  }
  a1[0] -= max(a[0] - a[9], 0);
  a2[0] -= max(a[0] - a[9], 0);
  r1.push_back(d);
  r2.push_back(10 - d);
  for (int i = (0); (i) < (10); (i)++) {
    for (int j = (0); (j) < (min(a1[i], a2[9 - i])); (j)++) {
      r1.push_back(i);
      r2.push_back(9 - i);
    }
    int r = min(a1[i], a2[9 - i]);
    a1[i] -= r;
    a2[9 - i] -= r;
  }
  for (int i = (0); (i) < (10); (i)++)
    for (int j = (0); (j) < (a1[i]); (j)++) r1.push_back(i);
  for (int i = (0); (i) < (10); (i)++)
    for (int j = (0); (j) < (a2[i]); (j)++) r2.push_back(i);
  for (int i = r1.size() - 1; i >= 0; i--) cout << r1[i];
  cout << endl;
  for (int i = r2.size() - 1; i >= 0; i--) cout << r2[i];
  return 0;
}