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;
void solve() {
  string s;
  cin >> s;
  map<int, int> m;
  map<int, int> n;
  for (char i : s) {
    m[i - '0']++;
    n[i - '0']++;
  }
  sort((s).begin(), (s).end());
  string ans1 = s, ans2 = s;
  int curz = 0;
  for (int i = (1); i < (10); i += 1) {
    if (!(m[i] > 0 && n[10 - i] > 0)) continue;
    m[i]--;
    n[10 - i]--;
    int curans = 1 + min(m[0], n[9]) + min(m[1], n[8]) + min(m[2], n[7]) +
                 min(m[3], n[6]) + min(m[4], n[5]) + min(m[5], n[4]) +
                 min(m[6], n[3]) + min(m[7], n[2]) + min(m[8], n[1]) +
                 min(m[9], n[0]) +
                 min(max(0, m[0] - n[9]), max(0, n[0] - m[9]));
    int zeroes = min(max(0, m[0] - n[9]), max(0, n[0] - m[9]));
    cerr << i << " " << curans << '\n';
    if (curans > curz) {
      curz = curans;
      map<int, int> used1;
      map<int, int> used2;
      ans1 = "";
      ans2 = "";
      for (int i = (0); i < (zeroes); i += 1) {
        ans1.push_back('0');
        ans2.push_back('0');
      }
      used1[0] += zeroes;
      used2[0] += zeroes;
      ans1.push_back(i + '0');
      ans2.push_back(10 - i + '0');
      for (int i = (0); i < (10); i += 1) {
        for (int j = (0); j < (min(m[i], n[9 - i])); j += 1) {
          ans1.push_back(i + '0');
          ans2.push_back(9 - i + '0');
          used1[i]++;
          used2[9 - i]++;
        }
      }
      int alpha = 0, beta = 0;
      for (int i = (0); i < (10); i += 1) alpha += m[i] - used1[i];
      for (int i = (0); i < (10); i += 1) beta += n[i] - used2[i];
      for (int kachra = (0); kachra < (10); kachra += 1) {
        for (int gf = (0); gf < (m[kachra] - used1[kachra]); gf += 1)
          ans1.push_back(kachra + '0');
      }
      for (int kachra = (0); kachra < (10); kachra += 1) {
        for (int gf = (0); gf < (n[kachra] - used2[kachra]); gf += 1)
          ans2.push_back(kachra + '0');
      }
    }
    m[i]++;
    n[10 - i]++;
  }
  reverse((ans2).begin(), (ans2).end());
  reverse((ans1).begin(), (ans1).end());
  cout << ans1 << '\n' << ans2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}