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;
#pragma comment(linker, "/STACK:255000000")
bool firstout = 1;
template <class T>
void minn(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
void maxx(T &a, T b) {
  if (a < b) a = b;
}
int madd(int &a, int b) {
  a += b;
  if (a >= 1000000009) a -= 1000000009;
  return a;
}
int msub(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000009;
  return a;
}
int mmult(int &a, int b) { return a = (long long)a * b % 1000000009; }
int mdiv(long long a, long long b, long long m) {
  a = (a % 1000000009 + 1000000009) % 1000000009;
  b = (b % 1000000009 + 1000000009) % 1000000009;
  if (a % b == 0) return a / b;
  return (a + m * mdiv(-a, m, b)) / b;
}
int n, m;
int A[10];
int B[10];
char S[101234];
vector<pair<int, int> > v;
int fnd() {
  int res = 0;
  int i;
  for (i = (0); i < (10); ++i) res += min(A[i], B[9 - i]);
  res += min(A[0] - min(A[0], B[9]), B[0] - min(B[0], A[9]));
  return res;
}
void fndDfs() {
  int i;
  for (i = (0); i < (10); ++i)
    for (; A[i] && B[9 - i]; --A[i], --B[9 - i])
      v.push_back(make_pair(i, 9 - i));
}
void print(int *C) {
  int m = min(A[0], B[0]);
  int i, j;
  for (i = (0); i < (C[0] - m); ++i)
    printf(
        "%"
        "d",
        (0));
  for (i = (1); i < (10); ++i)
    for (j = (0); j < (C[i]); ++j)
      printf(
          "%"
          "d",
          (i));
}
int main() {
  int i, j, k;
  char c;
  int a, d;
  int ts;
  for (ts = 1; scanf("%"
                     "s",
                     &(S)) > 0;
       ++ts) {
    for (i = (0); i < (10); ++i) A[i] = 0;
    n = strlen(S);
    for (i = (0); i < (n); ++i) ++A[S[i] - '0'];
    for (i = (0); i < (10); ++i) B[i] = A[i];
    int res = -1, a, b;
    a = b = -1;
    for (i = (1); i < (6); ++i)
      if (A[i] && B[10 - i]) {
        --A[i];
        --B[10 - i];
        int r = fnd();
        if (r > res) {
          res = r;
          a = i;
          b = 10 - i;
        }
        ++A[i];
        ++B[10 - i];
      }
    v.clear();
    if (res >= 0) {
      --A[a];
      --B[b];
      fndDfs();
    }
    print(A);
    for (i = (0); i < (v.size()); ++i)
      printf(
          "%"
          "d",
          (v[i].first));
    if (res >= 0)
      printf(
          "%"
          "d",
          (a));
    for (i = (0); i < (min(A[0], B[0])); ++i)
      printf(
          "%"
          "d",
          (0));
    printf("\n"), firstout = 1;
    print(B);
    for (i = (0); i < (v.size()); ++i)
      printf(
          "%"
          "d",
          (v[i].second));
    if (res >= 0)
      printf(
          "%"
          "d",
          (b));
    for (i = (0); i < (min(A[0], B[0])); ++i)
      printf(
          "%"
          "d",
          (0));
    printf("\n"), firstout = 1;
  }
  return 0;
}