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;
string s[2];
int d[2][10];
int main() {
  cin >> s[0];
  s[1] = s[0];
  for (int k = 0; k < 2; k++)
    for (int i = 0; i < s[k].length(); i++) ++d[k][s[k][i] - '0'];
  int ans = -1, bi = 0, bj = 0;
  int bc0[2];
  for (int i = 0; i < 10; i++)
    if (d[0][i] > 0)
      for (int j = 0; j < 10; j++)
        if (d[1][j] > 0 && i + j == 10) {
          int curr = 1;
          --d[0][i];
          --d[1][j];
          int c0[2];
          c0[0] = d[0][0];
          c0[1] = d[1][0];
          for (int k = 0, l = 9; k < 10; k++, l--) {
            curr += min(d[0][k], d[1][l]);
            if (k == 0) c0[0] -= min(d[0][k], d[1][l]);
            if (l == 0) c0[1] -= min(d[0][k], d[1][l]);
          }
          curr += min(c0[0], c0[1]);
          if (curr > ans) {
            ans = curr;
            bi = i;
            bj = j;
            bc0[0] = c0[0];
            bc0[1] = c0[1];
          }
          ++d[0][i];
          ++d[1][j];
        }
  if (ans == -1) {
    string s0 = "", s1 = "";
    for (int i = 0; i < d[0][0]; i++) s0 += '0';
    for (int i = 0; i < d[1][0]; i++) s1 += '0';
    for (int kk = 1; kk < 10; kk++) {
      for (int i = 0; i < d[0][kk]; i++) s0 += kk + '0';
      for (int i = 0; i < d[1][kk]; i++) s1 += kk + '0';
    }
    reverse(s0.begin(), s0.end());
    reverse(s1.begin(), s1.end());
    cout << s0 << endl << s1 << endl;
    return 0;
  }
  string s0 = "", s1 = "";
  int ttt = min(bc0[0], bc0[1]);
  for (int i = 0; i < min(bc0[0], bc0[1]); i++) s0 += '0', s1 += '0';
  d[0][0] -= ttt;
  d[1][0] -= ttt;
  s0 += bi + '0';
  s1 += bj + '0';
  --d[0][bi];
  --d[1][bj];
  for (int k = 0, l = 9; k < 10; k++, l--) {
    int ttt = min(d[0][k], d[1][l]);
    for (int tt = 1; tt <= min(d[0][k], d[1][l]); tt++)
      s0 += k + '0', s1 += l + '0';
    d[0][k] -= ttt;
    d[1][l] -= ttt;
  }
  for (int tt = 0; tt < 10; tt++) {
    for (int t0 = 1; t0 <= d[0][tt]; t0++) s0 += tt + '0';
    for (int t0 = 1; t0 <= d[1][tt]; t0++) s1 += tt + '0';
  }
  reverse(s0.begin(), s0.end());
  reverse(s1.begin(), s1.end());
  cout << s0 << endl << s1 << endl;
}