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;
const int MAX_N = 100010;
int len;
char str[MAX_N];
char num1[MAX_N], num2[MAX_N];
int cnt[10], cnt2[10];
pair<int, int> FindBestDigit() {
  int best_digit = str[0] - '0', max_zeros = 0, ending_zeros = -1;
  int total_zeros = cnt[0];
  while (cnt[0] >= 0) {
    if (total_zeros - cnt[0] > max_zeros) {
      best_digit = str[0] - '0';
      max_zeros = total_zeros - cnt[0];
      ending_zeros = max_zeros - cnt[0];
    }
    for (int i = 1; i < 10; ++i) {
      int rest = 10 - i;
      if (cnt[i] > 0 && cnt2[rest] > 0) {
        --cnt[i];
        --cnt2[rest];
        int zeros = total_zeros - cnt[0] + 1;
        for (int j = 0; j < 10; ++j) {
          zeros += min(cnt[j], cnt2[9 - j]);
        }
        if (zeros > max_zeros) {
          best_digit = i;
          max_zeros = zeros;
          ending_zeros = total_zeros - cnt[0];
        }
        ++cnt2[rest];
        ++cnt[i];
      }
    }
    --cnt[0];
  }
  cnt[0] = total_zeros;
  return make_pair(best_digit, ending_zeros);
}
void BuildSolution(pair<int, int> best) {
  int best_digit = best.first;
  int zeros = best.second;
  int pos1 = 0, pos2 = 0;
  for (int i = 1; i <= zeros; ++i) {
    ++pos1;
    ++pos2;
    --cnt[0];
    --cnt2[0];
    num1[len - pos1] = '0';
    num2[len - pos2] = '0';
  }
  --cnt[best_digit];
  int rest = 10 - best_digit;
  if (cnt2[rest] == 0) {
    for (int i = 0; i < 10; ++i) {
      if (cnt2[i] > 0) {
        rest = i;
      }
    }
  }
  ++pos1;
  ++pos2;
  --cnt2[rest];
  num1[len - pos1] = '0' + best_digit;
  num2[len - pos2] = '0' + rest;
  for (int i = 0; i < 10; ++i) {
    while (cnt[i] > 0 && cnt2[9 - i] > 0) {
      ++pos1;
      ++pos2;
      --cnt[i];
      --cnt2[9 - i];
      num1[len - pos1] = '0' + i;
      num2[len - pos2] = '0' + 9 - i;
    }
  }
  for (int i = 0; i < 10; ++i) {
    while (cnt[i] > 0) {
      --cnt[i];
      ++pos1;
      num1[len - pos1] = '0' + i;
    }
    while (cnt2[i] > 0) {
      --cnt2[i];
      ++pos2;
      num2[len - pos2] = '0' + i;
    }
  }
}
int main() {
  fgets(str, MAX_N, stdin);
  len = strlen(str) - 1;
  for (int i = 0; i < len; ++i) {
    ++cnt[str[i] - '0'];
    ++cnt2[str[i] - '0'];
  }
  pair<int, int> best = FindBestDigit();
  BuildSolution(best);
  printf("%s\n", num1);
  printf("%s\n", num2);
  return 0;
}