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;
template <class T>
typename T::value_type arr_sum(const T& v, int n) {
  typename T::value_type sum = 0;
  for (int i = (0); i < (n); ++i) sum += v[i];
  return sum;
}
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
int main() {
  string s1, s2;
  cin >> s1;
  s2 = s1;
  vector<int> v1(10);
  vector<int> v2(10);
  for (int i = (0); i < (10); ++i) {
    v1[i] = count(s1.begin(), s1.end(), i + '0');
    v2[i] = count(s2.begin(), s2.end(), i + '0');
  }
  int maxc = 0;
  vector<int> ans1;
  vector<int> ans2;
  vector<int> tt1;
  int tt2 = 0;
  while (v1[0] > v1[9]) {
    --v1[0];
    --v2[0];
    ++tt2;
    tt1.push_back(0);
    ans1.push_back(0);
    ans2.push_back(0);
  }
  maxc = tt2;
  for (int i = (0); i < (10); ++i) {
    for (int j = (0); j < (v1[i]); ++j) {
      ans1.push_back(i);
      ans2.push_back(i);
    }
  }
  for (int i = (1); i < (10); ++i) {
    vector<int> tmp1 = tt1;
    vector<int> tmp2 = tt1;
    int tmp = tt2;
    if (v1[i] == 0 || v2[10 - i] == 0) {
      continue;
    }
    --v1[i];
    --v2[10 - i];
    ++tmp;
    tmp1.push_back(i);
    tmp2.push_back(10 - i);
    for (int j = (0); j < (10); ++j) {
      int countc = min(v1[j], v2[9 - j]);
      tmp += countc;
      for (int k = (0); k < (countc); ++k) {
        tmp1.push_back(j);
        tmp2.push_back(9 - j);
      }
    }
    for (int j = (0); j < (10); ++j) {
      int countc1 = v1[j] - v2[9 - j];
      int countc2 = v2[9 - j] - v1[j];
      for (int k = (0); k < (countc1); ++k) {
        tmp1.push_back(j);
      }
      for (int k = (0); k < (countc2); ++k) {
        tmp2.push_back(9 - j);
      }
    }
    if (tmp > maxc) {
      maxc = tmp;
      ans1 = tmp1;
      ans2 = tmp2;
    }
    ++v1[i];
    ++v2[10 - i];
  }
  reverse(ans1.begin(), ans1.end());
  reverse(ans2.begin(), ans2.end());
  for (auto i : ans1) {
    cout << i;
  }
  cout << "\n";
  for (auto i : ans2) {
    cout << i;
  }
  cout << "\n";
}