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 n[10];
int n2[10];
int n3[10];
string ss;
int fd, l0;
int ma = -2;
int main() {
  ios::sync_with_stdio(false);
  cin >> ss;
  for (int i = 0; i < (int)ss.size(); ++i) {
    n[ss[i] - '0']++;
  }
  l0 = n[0];
  for (int i = 0; i < n[0] + 1; ++i) {
    for (int fr = 1; fr < 10; ++fr) {
      int ans = i + 1;
      for (int j = 0; j < 10; ++j) n2[j] = n3[j] = n[j];
      n2[0] -= i;
      n3[0] -= i;
      if (!n2[fr] || !n3[10 - fr]) continue;
      n2[fr]--;
      n3[10 - fr]--;
      for (int j = 0; j < 10; ++j) ans += min(n2[j], n3[9 - j]);
      if (ans > ma) {
        fd = fr;
        l0 = i;
        ma = ans;
      }
    }
  }
  for (int j = 0; j < 10; ++j) n2[j] = n3[j] = n[j];
  string ou = "";
  string ou2 = "";
  for (int i = 0; i < l0; ++i) {
    ou += '0';
    ou2 += '0';
    n2[0]--;
    n3[0]--;
  }
  if (n[fd] && n[10 - fd]) {
    n2[fd]--;
    n3[10 - fd]--;
    ou += '0' + fd;
    ou2 += '0' + 10 - fd;
  }
  for (int i = 0; i < 10; ++i) {
    int ti = min(n2[i], n3[9 - i]);
    for (int j = 0; j < ti; ++j) {
      n2[i]--;
      n3[9 - i]--;
      ou += '0' + i;
      ou2 += '0' + 9 - i;
    }
  }
  for (int i = 0; i < 10; ++i)
    while (n2[i]--) ou += '0' + i;
  for (int i = 0; i < 10; ++i)
    while (n3[i]--) ou2 += '0' + i;
  reverse(ou.begin(), ou.end());
  reverse(ou2.begin(), ou2.end());
  cout << ou << endl << ou2 << endl;
  return 0;
}