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, m, k, p, ans, ci, cj;
string s;
bool f2[200000];
int a[10], b1[10], b2[10], a1[200000], a2[200000];
int main() {
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    b1[s[i] - '0']++;
    b2[s[i] - '0']++;
  }
  for (int i = 0; i <= b1[0]; i++) {
    b1[0] -= i;
    b2[0] -= i;
    for (int j = 1; j < 10; j++) {
      int curans = i;
      if (b1[j] > 0 && b1[10 - j] > 0)
        curans++;
      else
        continue;
      b1[j]--;
      b2[10 - j]--;
      for (int k = 0; k < 10; k++) curans += min(b1[k], b2[9 - k]);
      b1[j]++;
      b2[10 - j]++;
      if (curans > ans) {
        ans = curans;
        ci = i;
        cj = j;
      }
    }
    b1[0] += i;
    b2[0] += i;
  }
  for (int i = s.length() - 1; s.length() - i <= ci; i--) {
    a1[i] = a2[i] = 0;
    b1[0]--;
    b2[0]--;
    f2[i] = true;
  }
  bool f = true;
  for (int i = s.length() - 1; i >= 0; i--) {
    if (f2[i]) continue;
    if (f) {
      if (b1[cj] > 0 && b1[10 - cj] > 0) {
        a1[i] = cj;
        a2[i] = 10 - cj;
        b1[cj]--;
        b2[10 - cj]--;
      } else {
        for (int j = 0; j < 10; j++)
          if (b1[j] > 0) {
            b1[j]--;
            a1[i] = j;
            break;
          }
        for (int j = 0; j < 10; j++)
          if (b2[j] > 0) {
            b2[j]--;
            a2[i] = j;
            break;
          }
      }
      f = false;
    } else {
      bool f1 = true;
      for (int j = 0; j < 10; j++) {
        if (b1[j] && b2[9 - j]) {
          b1[j]--;
          b2[9 - j]--;
          a1[i] = j;
          a2[i] = 9 - j;
          f1 = false;
          break;
        }
      }
      if (f1) {
        for (int j = 0; j < 10; j++)
          if (b1[j] > 0) {
            b1[j]--;
            a1[i] = j;
            break;
          }
        for (int j = 0; j < 10; j++)
          if (b2[j] > 0) {
            b2[j]--;
            a2[i] = j;
            break;
          }
      }
    }
  }
  for (int i = 0; i < s.length(); i++) cout << a1[i];
  cout << endl;
  for (int i = 0; i < s.length(); i++) cout << a2[i];
  cout << endl;
  return 0;
}