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 offer(int* amt0, int* amt1) {
  int ret = 0;
  for (int i = 0; i <= 9; ++i) {
    ret += min(amt0[i], amt1[9 - i]);
  }
  return ret;
}
void solve(int* amt0, int* amt1, int* best, int amt) {
  for (int i = 1; i <= 9; ++i) {
    if (min(amt0[i], amt1[10 - i]) == 0) continue;
    --amt0[i];
    --amt1[10 - i];
    int ans = offer(amt0, amt1) + amt + 1;
    if (ans > best[0]) {
      best[0] = ans;
      best[1] = amt;
      best[2] = i;
    }
    ++amt0[i];
    ++amt1[10 - i];
  }
}
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int zero = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') ++zero;
  }
  int amt[2][10] = {0};
  for (int i = 0; i < n; ++i) {
    ++amt[0][s[i] - '0'];
  }
  for (int i = 0; i < 10; ++i) {
    amt[1][i] = amt[0][i];
  }
  int best[3];
  best[0] = best[1] = 0;
  for (int i = 0; i <= zero; ++i) {
    solve(amt[0], amt[1], best, i);
    amt[0][0]--;
    amt[1][0]--;
  }
  amt[0][0] = amt[1][0] = zero;
  if (best[0] == 0) {
    if (zero == 0) {
      cout << s << endl << s;
    } else {
      string ans;
      for (int i = 0; i < n; ++i) {
        if (s[i] != '0') ans.push_back(s[i]);
      }
      for (int i = 0; i < zero; ++i) {
        ans.push_back('0');
      }
      cout << ans << endl << ans;
    }
    return 0;
  }
  string ans[2];
  const string d = "0123456789";
  for (int i = 0; i < best[1]; ++i) {
    ans[0].push_back(d[0]);
    ans[1].push_back(d[0]);
  }
  amt[0][0] -= best[1];
  amt[1][0] -= best[1];
  ans[0].push_back(d[best[2]]);
  ans[1].push_back(d[10 - best[2]]);
  amt[0][best[2]]--;
  amt[1][10 - best[2]]--;
  for (int i = 0; i <= 9; ++i) {
    int bound = min(amt[0][i], amt[1][9 - i]);
    for (int j = 0; j < bound; ++j) {
      ans[0].push_back(d[i]);
      ans[1].push_back(d[9 - i]);
    }
    amt[0][i] -= bound;
    amt[1][9 - i] -= bound;
  }
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < amt[0][i]; ++j) {
      ans[0].push_back(d[i]);
    }
    for (int j = 0; j < amt[1][i]; ++j) {
      ans[1].push_back(d[i]);
    }
  }
  reverse(ans[0].begin(), ans[0].end());
  reverse(ans[1].begin(), ans[1].end());
  cout << ans[0] << endl << ans[1];
  return 0;
}