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;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  string s;
  cin >> s;
  vector<int> f1(11, 0), f2;
  for (auto& d : s) {
    f1[d - '0']++;
  }
  f2 = f1;
  vector<pair<int, int> > ten;
  for (int i = 0; i <= 9; i++) {
    for (int j = 0; j <= 9; j++) {
      if (f1[i] > 0 and f2[j] > 0 and i + j == 10) {
        ten.push_back({i, j});
      }
    }
  }
  int mx = 0;
  deque<int> A, B;
  vector<int> resA, resB;
  auto solve = [&](pair<int, int> p) {
    vector<int> tmp1, tmp2;
    tmp1 = f1;
    tmp2 = f2;
    f1[p.first]--;
    f2[p.second]--;
    A.clear();
    B.clear();
    int zero = 1;
    A.push_back(p.first);
    B.push_back(p.second);
    for (int i = 0; i <= 9; i++) {
      for (int j = 0; j <= 9; j++) {
        while (f1[i] > 0 and f2[j] > 0 and i + j == 9) {
          A.push_back(i);
          B.push_back(j);
          f1[i]--;
          f2[j]--;
          zero++;
        }
      }
    }
    while (f1[0] > 0 and f2[0] > 0) {
      A.push_front(0);
      B.push_front(0);
      f1[0]--;
      f2[0]--;
      zero++;
    }
    for (int i = 0; i <= 9; i++) {
      while (f1[i] > 0) {
        A.push_back(i), f1[i]--;
      }
      while (f2[i] > 0) {
        B.push_back(i), f2[i]--;
      }
    }
    if (zero > mx) {
      mx = zero;
      resA.clear();
      resB.clear();
      for (auto& a : A) {
        resA.push_back(a);
      }
      for (auto& b : B) {
        resB.push_back(b);
      }
    }
    f1 = tmp1;
    f2 = tmp2;
    return;
  };
  for (auto& p : ten) {
    solve(p);
  }
  if (ten.empty()) {
    for (int i = 0; i <= 9; i++) {
      while (f1[i] > 0) {
        resA.push_back(i), f1[i]--;
      }
      while (f2[i] > 0) {
        resB.push_back(i), f2[i]--;
      }
    }
  }
  for (int i = resA.size() - 1; i >= 0; i--) {
    cout << resA[i];
  }
  cout << "\n";
  for (int i = resB.size() - 1; i >= 0; i--) {
    cout << resB[i];
  }
  cout << "\n";
}