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;
void sc(char &c) {
  char temp[4];
  scanf("%s", temp);
  c = temp[0];
}
void debugvi(vector<int> arr, int n = (int)1e9) {
  for (int i = 0; i < min(((int)(arr.size())), n); i++) printf("%d ", arr[i]);
  printf("\n");
}
int testnum;
char temp[100005];
int m, n;
int freq[2][15];
void preprocess() {}
void solve() {
  int best = 0;
  int bests = -1;
  int bestx = -1;
  for (int i = 1; i <= 9; i++) {
    int j = 0;
    if (i > 0) j = 10 - i;
    if (freq[0][i] == 0 || freq[1][j] == 0) continue;
    freq[0][i]--;
    freq[1][j]--;
    int cur = 1;
    for (int j = 0; j <= 9; j++) cur += min(freq[0][j], freq[1][9 - j]);
    int z = 0;
    if (freq[0][0] > freq[1][9] && freq[1][0] > freq[0][9])
      z = min(freq[0][0] - freq[1][9], freq[1][0] - freq[0][9]);
    cur += z;
    if (cur > best) {
      best = cur;
      bests = i;
      bestx = z;
    }
    freq[0][i]++;
    freq[1][j]++;
  }
  if (bests < 0) {
    for (int k = 0; k < 2; k++) {
      for (int i = 9; i >= 0; i--)
        for (int j = 0; j < freq[k][i]; j++) printf("%c", (char)('0' + i));
      printf("\n");
    }
    return;
  }
  string a = "", b = "";
  for (int i = 0; i < bestx; i++) {
    a += '0';
    b += '0';
    freq[0][0]--;
    freq[1][0]--;
  }
  int bestt = 0;
  if (bests > 0) bestt = 10 - bests;
  a += ((char)('0' + bests));
  b += ((char)('0' + bestt));
  freq[0][bests]--;
  freq[1][bestt]--;
  for (int j = 0; j <= 9; j++) {
    int z = min(freq[0][j], freq[1][9 - j]);
    for (int k = 0; k < z; k++) {
      a += ((char)('0' + j));
      b += ((char)('0' + 9 - j));
    }
    freq[0][j] -= z;
    freq[1][9 - j] -= z;
  }
  for (int k = 0; k < 2; k++) {
    for (int i = 0; i <= 9; i++)
      for (int j = 0; j < freq[k][i]; j++) {
        if (k == 0)
          a += ((char)('0' + i));
        else
          b += ((char)('0' + i));
      }
  }
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  printf("%s\n", a.c_str());
  printf("%s\n", b.c_str());
}
bool input() {
  memset(freq, 0, sizeof freq);
  scanf("%s", temp);
  m = strlen(temp);
  for (int i = 0; i < m; i++) freq[0][temp[i] - '0']++;
  for (int i = 0; i < 10; i++) freq[1][i] = freq[0][i];
  return true;
}
int main() {
  preprocess();
  int T = 1;
  for (testnum = 1; testnum <= T; testnum++) {
    if (!input()) break;
    solve();
  }
}