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 oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
int cnt1[10], cnt2[10];
string s, a1, a2;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> s;
  for (int i = 0; i < (int)(((long long)s.size())); ++i)
    cnt1[s[i] - '0']++, cnt2[s[i] - '0']++;
  int nines1[10] = {}, nines2[10] = {};
  for (int i = 0; i < (int)(10); ++i) {
    int t = min(cnt1[i], cnt2[9 - i]);
    nines1[i] = t;
    nines2[9 - i] = t;
    cnt1[i] -= t;
    cnt2[9 - i] -= t;
  }
  pair<int, int> p = make_pair(-1, -1);
  {
    for (int i = 1; i < (int)(10); i++) {
      if (cnt1[i] && cnt2[10 - i]) {
        cnt1[i]--, cnt2[10 - i]--;
        p = make_pair(i, 10 - i);
        break;
      }
    }
    if (p.first == -1) {
      for (int i = 1; i < (int)(10); i++) {
        if (nines1[i] && cnt2[10 - i]) {
          nines1[i]--, nines2[9 - i]--, cnt2[9 - i]++;
          cnt2[10 - i]--;
          p = make_pair(i, 10 - i);
          break;
        }
      }
    }
    if (p.first == -1) {
      for (int i = 1; i < (int)(10); i++) {
        if (nines1[i] && nines2[10 - i]) {
          nines1[i]--, nines2[9 - i]--, cnt2[9 - i]++;
          nines2[10 - i]--, nines1[9 - (10 - i)]--, cnt1[9 - (10 - i)]++;
          p = make_pair(i, 10 - i);
          break;
        }
      }
    }
  }
  int t = min(cnt1[0], cnt2[0]);
  a1 = a2 = string(t, '0');
  cnt1[0] -= t;
  cnt2[0] -= t;
  if (p.first == -1) {
    for (int i = 0; i < (int)(10); ++i)
      cnt1[i] += nines1[i], cnt2[i] += nines2[i];
  } else {
    a1 += p.first + '0';
    a2 += p.second + '0';
    for (int i = 0; i < (int)(10); ++i) {
      for (int k = 0; k < (int)(nines1[i]); ++k) {
        a1 += '0' + i;
        a2 += '0' + 9 - i;
      }
    }
  }
  for (int i = 0; i < (int)(10); ++i)
    for (int k = 0; k < (int)(cnt1[i]); ++k) a1 += '0' + i;
  for (int i = 0; i < (int)(10); ++i)
    for (int k = 0; k < (int)(cnt2[i]); ++k) a2 += '0' + i;
  reverse(a1.begin(), a1.end());
  reverse(a2.begin(), a2.end());
  cout << a1 << endl;
  cout << a2 << endl;
  return 0;
}