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 str[100010];
int digit_num[10];
int digit_up[10];
int digit_down[10];
int flage;
int len;
int imax;
int flage_num;
void Init() {
  cin >> str;
  memset(digit_num, 0, sizeof(digit_num));
  flage = false;
  imax = 0;
  len = strlen(str);
  for (int i = 0; i < len; i++) {
    int temp = str[i] - '0';
    digit_num[temp]++;
  }
}
int Count_howmany() {
  int ans = 0;
  if (digit_up[0] > digit_down[9]) {
    ans += digit_up[0] - (digit_up[9] + digit_down[9] + 1) / 2;
    digit_up[0] -= ans;
    digit_down[0] -= ans;
  }
  for (int i = 0; i <= 9; i++) {
    for (; digit_up[i] > 0;)
      if (digit_up[i] && digit_down[9 - i]) {
        digit_up[i]--;
        digit_down[9 - i]--;
        ans++;
      } else
        break;
  }
  return ans + 1;
}
void Deal() {
  int ans;
  int temp;
  for (int i = 1; i <= 5; i++) {
    memcpy(digit_down, digit_num, sizeof(int) * 10);
    memcpy(digit_up, digit_num, sizeof(int) * 10);
    if (digit_up[i] && digit_up[10 - i]) {
      digit_up[10 - i]--;
      digit_down[i]--;
      temp = Count_howmany();
      if (temp > imax) {
        imax = temp;
        flage_num = i;
      }
      flage = true;
    }
  }
}
void Reverse(char *a) {
  char temp;
  for (int i = 0; i < len / 2; i++) {
    temp = a[i];
    a[i] = a[len - 1 - i];
    a[len - 1 - i] = temp;
  }
}
void Output() {
  char out_a[100010];
  char out_b[100010];
  int cnt = 0;
  int ans = 0;
  memcpy(digit_down, digit_num, sizeof(int) * 10);
  memcpy(digit_up, digit_num, sizeof(int) * 10);
  if (flage) {
    digit_up[10 - flage_num]--;
    digit_down[flage_num]--;
    if (digit_up[0] > digit_down[9]) {
      ans += digit_up[0] - (digit_up[9] + digit_down[9] + 1) / 2;
      digit_up[0] -= ans;
      digit_down[0] -= ans;
    }
    for (int i = 0; i < ans; i++) out_a[i] = out_b[i] = '0';
    cnt = ans;
    out_a[cnt] = 10 - flage_num + '0';
    out_b[cnt] = flage_num + '0';
    cnt++;
    for (int i = 0; i <= 9; i++) {
      for (; digit_up[i] > 0;)
        if (digit_up[i] && digit_down[9 - i]) {
          digit_up[i]--;
          digit_down[9 - i]--;
          out_a[cnt] = i + '0';
          out_b[cnt] = 9 - i + '0';
          cnt++;
        } else
          break;
    }
    int temp = cnt;
    for (int i = 0; i <= 9; i++)
      for (int j = 0; j < digit_up[i]; j++) out_a[temp++] = i + '0';
    for (int i = 0; i <= 9; i++)
      for (int j = 0; j < digit_down[i]; j++) out_b[cnt++] = i + '0';
  } else {
    if (digit_up[0] > digit_down[9]) {
      ans += digit_up[0] - (digit_up[9] + digit_down[9] + 1) / 2;
      digit_up[0] -= ans;
      digit_down[0] -= ans;
    }
    for (int i = 0; i < ans; i++) out_a[i] = out_b[i] = '0';
    cnt = ans;
    int temp = cnt;
    for (int i = 1; i <= 9; i++)
      for (int j = 0; j < digit_up[i]; j++) out_a[temp++] = i + '0';
    for (int i = 1; i <= 9; i++)
      for (int j = 0; j < digit_down[i]; j++) out_b[cnt++] = i + '0';
  }
  out_a[len] = 0;
  out_b[len] = 0;
  Reverse(out_a);
  Reverse(out_b);
  cout << out_a << endl;
  cout << out_b << endl;
}
int main() {
  Init();
  Deal();
  Output();
  return 0;
}