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 buf[1 << 20];
int A[16];
int B[16];
int main() {
  scanf("%s", buf);
  int n = strlen(buf);
  int i, j, k;
  memset(A, 0, sizeof(A));
  for (i = (0); i < (n); ++i) ++A[buf[i] - '0'];
  for (i = (0); i < (10); ++i) B[i] = A[i];
  int res = -1;
  string ra = buf;
  string rb = buf;
  sort((ra).begin(), (ra).end());
  reverse((ra).begin(), (ra).end());
  rb = ra;
  for (i = (1); i < (10); ++i)
    if (A[i] != 0 && B[10 - i] != 0) {
      --A[i];
      --B[10 - i];
      int r = 0;
      string a = "";
      string b = "";
      string aa = "";
      string bb = "";
      for (j = (0); j < (10); ++j) {
        int t = min(A[j], B[9 - j]);
        r += t;
        for (k = (t); k < (A[j]); ++k) a.push_back('0' + j);
        for (k = (t); k < (B[9 - j]); ++k) b.push_back('0' + 9 - j);
        for (k = (0); k < (t); ++k) {
          aa.push_back('0' + j);
          bb.push_back('0' + 9 - j);
        }
      }
      aa.push_back('0' + i);
      bb.push_back('0' + 10 - i);
      sort((a).begin(), (a).end());
      sort((b).begin(), (b).end());
      int cnt = 0;
      while (int((a).size()) > cnt && int((b).size()) > cnt && a[cnt] == '0' &&
             b[cnt] == '0')
        ++cnt;
      a = a.substr(cnt);
      b = b.substr(cnt);
      aa = aa + string(cnt, '0');
      bb = bb + string(cnt, '0');
      if (r > res) {
        res = r;
        ra = a + aa;
        rb = b + bb;
      }
      ++A[i];
      ++B[10 - i];
    }
  printf("%s\n%s\n", ra.c_str(), rb.c_str());
  return 0;
};