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 long double EPS = 1E-9;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double PI = 2 * acos(.0);
int main() {
  string num;
  cin >> num;
  int a[11];
  fill(a, a + 11, 0);
  for (int i = 0; i < (int)((num).size()); i++) {
    a[num[i] - '0']++;
  }
  int cont = 0;
  string temp1 = num;
  string temp2 = num;
  int a2[11];
  int a3[11];
  bool cent = 1;
  for (int i = 1; i < (int)(10); i++) {
    int temp = 0;
    char kk1 = 's', kk2 = 's';
    vector<pair<char, int> > t1;
    vector<pair<char, int> > t2;
    for (int j = 0; j < (int)(10); j++) a2[j] = a3[j] = a[j];
    if (a2[i] > 0 && a3[10 - i] > 0) {
      a2[i]--;
      a3[10 - i]--;
      kk1 = '0' + i;
      kk2 = '0' + (10 - i);
    } else
      continue;
    temp = 1;
    for (int j = 0; j < (int)(10); j++) {
      int mini = min(a2[j], a3[9 - j]);
      temp += mini;
      a2[j] -= mini;
      a3[9 - j] -= mini;
      t1.push_back(make_pair('0' + j, mini));
      t2.push_back(make_pair('0' + (9 - j), mini));
    }
    temp += min(a2[0], a3[0]);
    int conta = min(a2[0], a3[0]);
    a2[0] -= conta;
    a3[0] -= conta;
    if (temp > cont) {
      cent = 0;
      temp1 = "";
      temp2 = "";
      for (int j = 0; j < (int)(10); j++) {
        if (a2[j] > 0) temp1.append(a2[j], '0' + j);
        if (a3[j] > 0) temp2.append(a3[j], '0' + j);
      }
      for (int j = 0; j < (int)((t1).size()); j++) {
        temp1.append(t1[j].second, t1[j].first);
        temp2.append(t2[j].second, t2[j].first);
      }
      temp1 += kk1;
      temp2 += kk2;
      temp1.append(conta, '0');
      temp2.append(conta, '0');
      cont = temp;
    }
  }
  if (cent) {
    temp1 = "";
    temp2 = "";
    for (int j = 1; j < (int)(10); j++) {
      if (a[j] > 0) temp1.append(a[j], '0' + j);
      if (a[j] > 0) temp2.append(a[j], '0' + j);
    }
    temp1.append(a[0], '0');
    temp2.append(a[0], '0');
  }
  cout << temp1 << endl << temp2 << endl;
  return 0;
}