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_L = 1e5;
char buf[MAX_L + 1], s1[MAX_L + 1], s2[MAX_L + 1], t1[MAX_L + 1], t2[MAX_L + 1];
int ds[10], ts[2][10];
void init() { scanf("%[^\n]%*c", buf); }
void prn(int key) {
  const int L = strlen(buf);
  for (int i = 0; i < 10; i++) {
    ts[0][i] = ds[i];
    ts[1][i] = ds[i];
  }
  int p = 0;
  ts[0][key]--;
  ts[1][(10 - key) % 10]--;
  s1[p] = key + '0';
  s2[p++] = (10 - key) % 10 + '0';
  for (int i = 0; i < L; i++) {
    bool update = false;
    for (int i = 0; i < 10; i++) {
      if (ts[0][i] > 0 && ts[1][9 - i] > 0) {
        ts[0][i]--;
        ts[1][9 - i]--;
        s1[p] = i + '0';
        s2[p++] = 9 - i + '0';
        update = true;
        break;
      }
    }
    if (!update) {
      break;
    }
  }
  int q = 0;
  for (; ts[0][0] > 0 && ts[1][0] > 0;) {
    ts[0][0]--;
    ts[1][0]--;
    t1[L - 1 - q] = t2[L - 1 - q] = '0';
    q++;
  }
  for (int i = 0; i < p; i++) {
    t1[L - 1 - q] = s1[i];
    t2[L - 1 - q++] = s2[i];
  }
  while (q < L) {
    for (int i = 9; i >= 0; i--) {
      if (ts[0][i] > 0) {
        ts[0][i]--;
        t1[L - 1 - q] = i + '0';
        break;
      }
    }
    for (int i = 9; i >= 0; i--) {
      if (ts[1][i] > 0) {
        ts[1][i]--;
        t2[L - 1 - q++] = i + '0';
        break;
      }
    }
  }
  puts(t1);
  puts(t2);
}
int check(int x) {
  const int L = strlen(buf);
  for (int i = 0; i < 10; i++) {
    ts[0][i] = ds[i];
    ts[1][i] = ds[i];
  }
  int ans = 1;
  if (--ts[0][x] < 0) {
    return -1;
  }
  if (--ts[1][(10 - x) % 10] < 0) {
    return -1;
  }
  for (int i = 0; i < L; i++) {
    bool update = false;
    for (int i = 0; i < 10; i++) {
      if (ts[0][i] > 0 && ts[1][9 - i] > 0) {
        ts[0][i]--;
        ts[1][9 - i]--;
        update = true;
        ans++;
        break;
      }
    }
    if (!update) {
      break;
    }
  }
  return ans + min(ts[0][0], ts[1][0]);
}
void solve() {
  for (int i = 0; buf[i]; i++) {
    ds[buf[i] - '0']++;
  }
  if (0)
    for (int i = 0; i < 10; i++) {
      printf("%d\n", ds[i]);
    }
  int best = -1, key = -1;
  for (int i = 1; i < 10; i++) {
    int score = check(i);
    if (best < score) {
      best = score;
      key = i;
    }
  }
  if (key > 0) {
    prn(key);
  } else {
    const int L = strlen(buf);
    sort(buf, buf + L);
    reverse(buf, buf + L);
    puts(buf);
    puts(buf);
  }
}
int main() {
  init();
  solve();
  return 0;
}