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 D = 10;
int c1[D], c2[D];
int c[D];
int n;
int zpair[D][D];
int zeroCount(int x, int y) {
  if (x + y < D) return 0;
  int ret = 0, done = 0;
  --c1[x], --c2[y];
  ++done;
  if (x + y == D) ++ret;
  for (int i = 0; i < D; ++i) {
    int cur = min(c1[i], c2[D - 1 - i]);
    c1[i] -= cur;
    c2[D - 1 - i] -= cur;
    ret += cur;
    done += cur;
  }
  int mzero = min(c1[0], c2[0]);
  c1[0] -= mzero;
  c2[0] -= mzero;
  done += mzero;
  ret += mzero;
  return ret;
}
vector<pair<int, int> > permute(int x, int y) {
  vector<pair<int, int> > ret;
  int done = 0;
  --c1[x], --c2[y];
  ret.push_back({x, y});
  ++done;
  for (int i = 0; i < D; ++i) {
    int cur = min(c1[i], c2[D - 1 - i]);
    c1[i] -= cur;
    c2[D - 1 - i] -= cur;
    done += cur;
    for (int k = 0; k < cur; ++k) ret.push_back({i, D - 1 - i});
  }
  int mzero = min(c1[0], c2[0]);
  c1[0] -= mzero;
  c2[0] -= mzero;
  done += mzero;
  vector<pair<int, int> > temp(mzero, pair<int, int>(0, 0));
  for (auto &x : ret) temp.push_back(x);
  ret = temp;
  vector<int> v1, v2;
  for (int i = 0; i < D; ++i) {
    while (c1[i]) {
      v1.push_back(i);
      --c1[i];
    }
    while (c2[i]) {
      v2.push_back(i);
      --c2[i];
    }
  }
  for (int i = 0; i < (int)v1.size(); ++i) {
    ret.push_back({v1[i], v2[i]});
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  n = (int)s.size();
  for (char ch : s) ++c[ch - '0'];
  pair<int, int> st(-1, -1);
  int tot = -1;
  for (int i = 1; i < D; ++i) {
    for (int j = 1; j < D; ++j) {
      for (int k = 0; k < D; ++k) c1[k] = c2[k] = c[k];
      if (!c1[i] or !c2[j]) continue;
      int zer = zeroCount(i, j);
      if (zer > tot) {
        tot = zer;
        st = make_pair(i, j);
      }
    }
  }
  for (int k = 0; k < D; ++k) c1[k] = c2[k] = c[k];
  auto res = permute(st.first, st.second);
  reverse(res.begin(), res.end());
  for (auto &x : res) cout << x.first;
  cout << "\n";
  for (auto &x : res) cout << x.second;
  cout << "\n";
  return 0;
}