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;
bool check(int a[]) {
  for (int i = 0; i <= 9; i++) {
    if (a[i] < 0) {
      return false;
    }
  }
  return true;
}
int solve(int a[], int c[]) {
  int num = 0;
  for (int i = 0; i <= 9; i++) {
    if (a[i] > 0 && c[9 - i] > 0) {
      int tmp = min(a[i], c[9 - i]);
      num += tmp;
      a[i] -= tmp;
      c[9 - i] -= tmp;
    }
  }
  return num;
}
int a[10], c[10], d[10];
int main() {
  memset(a, 0, sizeof(a));
  string s;
  cin >> s;
  int len = s.size();
  for (int i = 0; i < len; i++) {
    a[s[i] - '0']++;
  }
  int flag = 0;
  vector<int> b;
  for (int i = 1; i <= 5; i++) {
    if (a[i] > 0 && a[10 - i] > 0) {
      flag = 1;
      b.push_back(i);
    }
  }
  string ans1 = "", ans2 = "";
  string tmp = "";
  if (flag) {
    int Size = b.size();
    int ans = -1;
    int ans_number = -1;
    for (int i = 0; i < Size; i++) {
      for (int j = 0; j <= 9; j++) {
        c[j] = a[j];
        d[j] = a[j];
      }
      c[b[i]]--;
      d[10 - b[i]]--;
      if (check(c)) {
        int cnt = solve(c, d);
        if (cnt > ans) {
          ans = cnt;
          ans_number = b[i];
        }
      } else
        break;
    }
    for (int j = 0; j <= 9; j++) c[j] = a[j];
    string tmp1 = "", tmp2 = "";
    if (ans_number > 0) {
      a[ans_number]--;
      c[10 - ans_number]--;
      tmp1 = '0' + ans_number;
      tmp2 = '0' + 10 - ans_number;
    }
    for (int i = 0; i <= 9; i++) {
      if (a[i] > 0 && c[9 - i] > 0) {
        int t = min(a[i], c[9 - i]);
        while (t) {
          ans1 += i + '0';
          ans2 += 9 - i + '0';
          a[i]--;
          c[9 - i]--;
          t--;
        }
      }
    }
    ans1 += tmp1;
    ans2 += tmp2;
    if (a[0] > 0 && c[0] > 0) {
      while (min(a[0], c[0])) {
        ans1 += '0';
        a[0]--;
        ans2 += '0';
        c[0]--;
      }
    }
    tmp1 = "";
    tmp2 = "";
    for (int i = 0; i <= 9; i++) {
      if (a[i] > 0) {
        while (a[i]) {
          tmp1 += '0' + i;
          a[i]--;
        }
      }
      if (c[i] > 0) {
        while (c[i]) {
          tmp2 += '0' + i;
          c[i]--;
        }
      }
    }
    ans1 = tmp1 + ans1;
    ans2 = tmp2 + ans2;
    cout << ans1 << endl;
    cout << ans2 << endl;
  } else {
    for (int i = 0; i <= 9; i++) c[i] = a[i];
    while (a[0]) {
      ans1 += '0';
      ans2 += '0';
      a[0]--;
      c[0]--;
    }
    string tmp1 = "";
    string tmp2 = "";
    for (int i = 0; i <= 9; i++) {
      if (a[i] > 0) {
        while (a[i]) {
          tmp1 += '0' + i;
          a[i]--;
        }
      }
      if (c[i] > 0) {
        while (c[i]) {
          tmp2 += '0' + i;
          c[i]--;
        }
      }
    }
    ans1 = tmp1 + ans1;
    ans2 = tmp2 + ans2;
    cout << ans1 << endl;
    cout << ans2 << endl;
  }
  return 0;
}