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;
deque<int> a, b;
int main() {
  string num;
  int i, j, k, f = 1, m;
  int v1[10] = {0}, v2[10] = {0};
  cin >> num;
  for (i = 0; i < num.length(); i++) {
    v1[num[i] - '0']++;
    v2[num[i] - '0']++;
  }
  for (i = 9, j = 0; i >= 0 && j <= 9;) {
    if (v1[i] && v2[j]) {
      v1[i]--;
      v2[j]--;
      a.push_back(i);
      b.push_back(j);
    } else {
      i--;
      j++;
    }
  }
  for (i = 9, j = 1; i >= 1 && j <= 9;) {
    if (v1[i] && v2[j]) {
      v1[i]--;
      v2[j]--;
      a.push_back(i);
      b.push_back(j);
      f = 0;
      break;
    } else {
      i--;
      j++;
    }
  }
  m = min(v1[0], v2[0]);
  v1[0] -= m;
  v2[0] -= m;
  for (i = 9; i >= 0;)
    if (v1[i]) {
      a.push_front(i);
      v1[i]--;
    } else
      i--;
  for (i = 9; i >= 0;)
    if (v2[i]) {
      b.push_front(i);
      v2[i]--;
    } else
      i--;
  if (f) {
    int l1, l2, r1, r2;
    int q1[10] = {0}, q2[10] = {0};
    for (i = 0, j = a.size() - 1; i < a.size(); i++, j--) {
      if (!q1[a[i]]) q1[a[i]] = i + 1;
      if (!q2[b[j]]) q2[b[j]] = j + 1;
    }
    for (i = 1, j = 9; i <= 9; i++, j--)
      if (q1[i] && q2[j] && q1[i] < q2[j]) {
        i = q1[i] - 1;
        j = q2[j] - 1;
        if (i < j) {
          l1 = a[i];
          r1 = b[j];
          l2 = a[j];
          r2 = b[i];
        } else {
          l1 = a[j];
          r1 = b[i];
          l2 = a[i];
          r2 = b[j];
        }
        a[i] = -1;
        a[j] = -1;
        b[i] = -1;
        b[j] = -1;
        a.push_front(l2);
        a.push_back(l1);
        b.push_front(r2);
        b.push_back(r1);
        break;
      }
  }
  a.resize(a.size() + m);
  b.resize(b.size() + m);
  for (i = 0; i < a.size(); i++)
    if (a[i] != -1) cout << a[i];
  cout << endl;
  for (i = 0; i < b.size(); i++)
    if (b[i] != -1) cout << b[i];
  cout << endl;
  return 0;
}