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;
inline void err(istringstream *iss) {}
template <typename T, typename... Args>
void err(istringstream *iss, const T &$val, const Args &...args) {
  string $name;
  *iss >> $name;
  if ($name.back() == ',') $name.pop_back();
  cout << $name << " = " << $val << "; ", err(iss, args...);
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
int n, m, K, T, Q, cn;
char s[100005], ans[2][100005];
int cnt[2][11], ai;
int main() {
  cin.tie(NULL);
  scanf("%s", s);
  n = int(strlen(s));
  for (int i = 0; i < n; i++) {
    cnt[0][s[i] - '0']++, cnt[1][s[i] - '0']++;
  }
  int c0 = cnt[0][0], mx = c0, mxi = 0, mx0 = 0;
  for (int _i = 0; _i <= cnt[0][0]; _i++) {
    cnt[0][0] = cnt[1][0] = _i;
    for (int i = 1; i <= 9; i++) {
      if (!cnt[0][i] or !cnt[1][10 - i]) continue;
      cnt[0][i]--, cnt[1][10 - i]--;
      int cur = c0 - cnt[0][0] + 1;
      for (int j = 0; j <= 9; j++) {
        cur += min(cnt[0][j], cnt[1][9 - j]);
      }
      if (cur > mx) mx = cur, mxi = i, mx0 = _i;
      cnt[0][i]++, cnt[1][10 - i]++;
    }
    cnt[0][0] = cnt[1][0] = c0;
  }
  ans[0][n] = ans[1][n] = '\0', ai = n - 1;
  if (mxi) {
    cnt[0][0] = cnt[1][0] = mx0;
    for (int i = mx0 + 1; i <= c0; i++) {
      ans[0][ai] = ans[1][ai] = 0, ai--;
    }
    ans[0][ai] = mxi, ans[1][ai] = 10 - mxi, ai--, cnt[0][mxi]--,
    cnt[1][10 - mxi]--;
    for (int i = 0; i <= 9; i++) {
      int mn = min(cnt[0][i], cnt[1][9 - i]);
      for (int j = 0; j < mn; j++) {
        ans[0][ai] = i, ans[1][ai] = 9 - i, ai--, cnt[0][i]--, cnt[1][9 - i]--;
      }
    }
    int ai0 = ai, ai1 = ai;
    for (int i = 0; i <= 9; i++) {
      for (int j = 0; j < cnt[0][i]; j++) {
        ans[0][ai0] = i, ai0--;
      }
      for (int j = 0; j < cnt[1][i]; j++) {
        ans[1][ai1] = i, ai1--;
      }
    }
  } else {
    for (int i = 0; i <= 9; i++) {
      for (int j = 0; j < cnt[0][i]; j++) {
        ans[0][ai] = i, ans[1][ai] = i, ai--;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    ans[0][i] += '0', ans[1][i] += '0';
  }
  printf("%s\n%s\n", ans[0], ans[1]);
  return 0;
}