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>
static int ndigits1[10], ndigits2[10];
char DP1[100000 + 1], DP2[100000 + 1];
static int n = 0;
int min(int a, int b) { return (a < b) ? a : b; }
void Digits_Permutations() {
  char digit;
  while ((digit = getchar()) != '\n') {
    ndigits1[digit - '0']++;
    ndigits2[digit - '0']++;
    n++;
  }
  int flag = 0;
  int nzero = 0;
  int i, j;
  for (i = 1; i < 10; i++) {
    if (!ndigits1[i] || !ndigits2[10 - i]) continue;
    int curnzero = 1;
    ndigits1[i]--;
    ndigits2[10 - i]--;
    for (j = 0; j < 10; j++) curnzero += min(ndigits1[j], ndigits2[9 - j]);
    curnzero += (min(ndigits1[0] - ndigits2[9], ndigits2[0] - ndigits1[9]) > 0)
                    ? min(ndigits1[0] - ndigits2[9], ndigits2[0] - ndigits1[9])
                    : 0;
    if (curnzero > nzero) {
      flag = i;
      nzero = curnzero;
    }
    ndigits1[i]++;
    ndigits2[10 - i]++;
  }
  if (flag) {
    ndigits1[flag]--;
    ndigits2[10 - flag]--;
  }
  DP1[n] = DP2[n] = '\0';
  i = n - 1;
  for (j = min(ndigits1[0] - ndigits2[9], ndigits2[0] - ndigits1[9]); j > 0;
       j--, i--, ndigits1[0]--, ndigits2[0]--)
    DP1[i] = DP2[i] = '0';
  if (flag) {
    DP1[i] = flag + '0';
    DP2[i] = 10 - flag + '0';
    i--;
  }
  for (j = 0; j < 10; j++)
    while (ndigits1[j] && ndigits2[9 - j]) {
      DP1[i] = j + '0';
      DP2[i] = 9 - j + '0';
      i--;
      ndigits1[j]--;
      ndigits2[9 - j]--;
    }
  int cur = i;
  for (j = 0; j < 10; j++)
    while (ndigits1[j]) {
      DP1[i--] = j + '0';
      ndigits1[j]--;
    }
  i = cur;
  for (j = 0; j < 10; j++)
    while (ndigits2[j]) {
      DP2[i--] = j + '0';
      ndigits2[j]--;
    }
  printf("%s\n%s\n", DP1, DP2);
}
int main() {
  Digits_Permutations();
  return 0;
}