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 inf = 1 << 30;
const long long linf = 1LL << 60;
const int maxn = 100 * 1000 + 5;
char s[maxn];
int cnt1[15], cnt2[15];
int bal1[15], bal2[15];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; ++i) {
    ++cnt1[s[i] - '0'];
    ++cnt2[s[i] - '0'];
  }
  string ans1 = "";
  string ans2 = "";
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < cnt1[i]; ++j) {
      ans1 += i + '0';
      ans2 += i + '0';
    }
  }
  int res = cnt1[0];
  for (int st = 1; st < 10; ++st) {
    if (!cnt1[st] || !cnt1[10 - st]) continue;
    --cnt1[st];
    --cnt2[10 - st];
    string _ans1 = "", _ans2 = "";
    memset(bal1, 0, sizeof(bal1));
    memset(bal2, 0, sizeof(bal2));
    _ans1 += st + '0';
    _ans2 += 10 - st + '0';
    int _res = 1;
    for (int pos = 0; pos < 10; ++pos) {
      int d = min(cnt1[pos], cnt2[9 - pos]);
      for (int i = 0; i < d; ++i) {
        _ans1 += pos + '0';
        _ans2 += 9 - pos + '0';
      }
      for (int i = cnt2[9 - pos]; i < cnt1[pos]; ++i) ++bal1[pos];
      for (int i = cnt1[pos]; i < cnt2[9 - pos]; ++i) ++bal2[9 - pos];
      _res += d;
    }
    int minz = min(bal1[0], bal2[0]);
    bal1[0] -= minz;
    bal2[0] -= minz;
    string strz = "";
    for (int i = 0; i < minz; ++i) strz += '0';
    _ans1 = strz + _ans1;
    _ans2 = strz + _ans2;
    for (int i = 0; i < 10; ++i) {
      for (int j = 0; j < bal1[i]; ++j) _ans1 += i + '0';
      for (int j = 0; j < bal2[i]; ++j) _ans2 += i + '0';
    }
    if (_res > res) {
      ans1 = _ans1;
      ans2 = _ans2;
      res = _res;
    }
    ++cnt1[st];
    ++cnt2[10 - st];
  }
  reverse((ans1).begin(), (ans1).end());
  reverse((ans2).begin(), (ans2).end());
  cout << ans1 << "\n" << ans2 << "\n";
  return 0;
}