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;
char s[100010];
int a[15];
int b[15], c[15];
char ans1[100010];
char ans2[100010];
char t1[100010];
int run;
char t2[100010];
int main() {
  int m = 0, OK, temp, mini, zero = 0, run1, run2, check = 0, cc = 0;
  cin >> s;
  int k = strlen(s);
  for (int i = 0; i < k; i++) {
    a[(int)(s[i] - '0')]++;
  }
  for (int i = 1; i <= 5; i++) {
    run = 0;
    t1[run] = i + '0';
    t2[run] = 10 - i + '0';
    run = 1;
    zero = 0;
    temp = 1;
    OK = 0;
    for (int j = 0; j <= 9; j++) b[j] = a[j];
    for (int j = 0; j <= 9; j++) c[j] = a[j];
    if (b[i] > 0)
      b[i]--;
    else
      OK = 1;
    if (c[10 - i] > 0)
      c[10 - i]--;
    else
      OK = 1;
    if (OK == 0) {
      check = 1;
      for (int j = 9; j >= 0; j--) {
        mini = b[j];
        if (mini > c[9 - j]) mini = c[9 - j];
        temp += mini;
        b[j] -= mini;
        c[9 - j] -= mini;
        for (int ll = 0; ll < mini; ll++) {
          t1[run] = j + '0';
          t2[run] = 9 - j + '0';
          run++;
        }
      }
      zero = b[0];
      if (zero > c[0]) zero = c[0];
      b[0] -= zero;
      c[0] -= zero;
      temp += zero;
      if (m < temp) {
        run1 = 0;
        run2 = 0;
        m = temp;
        for (int j = 0; j < zero; j++) {
          ans1[run1++] = '0';
          ans2[run2++] = '0';
        }
        for (int j = 0; j < run; j++) {
          ans1[run1++] = t1[j];
          ans2[run2++] = t2[j];
        }
        for (int j = 0; j < 10; j++) {
          for (int aa = 0; aa < b[j]; aa++) {
            ans1[run1++] = j + '0';
          }
          for (int aa = 0; aa < c[j]; aa++) {
            ans2[run2++] = j + '0';
          }
        }
      }
    }
  }
  if (check == 1) {
    for (int i = 0; i < k; i++) cout << ans1[k - 1 - i];
    cout << endl;
    for (int i = 0; i < k; i++) cout << ans2[k - 1 - i];
    cout << endl;
  } else if (check == 0) {
    cc = 0;
    for (int i = 0; i < k; i++) {
      if (s[i] == '0')
        cc++;
      else
        cout << s[i];
    }
    for (int i = 0; i < cc; i++) cout << '0';
    cout << endl;
    cc = 0;
    for (int i = 0; i < k; i++) {
      if (s[i] == '0')
        cc++;
      else
        cout << s[i];
    }
    for (int i = 0; i < cc; i++) cout << '0';
    cout << endl;
  }
  scanf(" ");
}