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 MAXN = 500010;
const double eps = 1e-9;
const int INF = 1000000000;
char str[MAXN];
int cnt1[10], cnt2[10];
int main() {
  int ans = 0, azero, alast1;
  while (~scanf("%s", str)) {
    memset(cnt1, 0, sizeof(cnt1));
    for (int i = 0; str[i]; ++i) ++cnt1[str[i] - '0'];
    memcpy(cnt2, cnt1, sizeof(cnt2));
    ans = cnt1[0];
    azero = 0;
    alast1 = 0;
    for (int zero = 0; zero <= cnt1[0]; ++zero) {
      cnt1[0] -= zero;
      cnt2[0] -= zero;
      for (int last1 = 1; last1 < 10; ++last1)
        if (cnt1[last1] > 0 && cnt2[10 - last1] > 0) {
          int last2 = 10 - last1;
          int tmp = zero + 1;
          --cnt1[last1];
          --cnt2[last2];
          for (int i = 0; i < 10; ++i) tmp += min(cnt1[i], cnt2[9 - i]);
          if (tmp > ans) {
            ans = tmp;
            azero = zero;
            alast1 = last1;
          }
          ++cnt1[last1];
          ++cnt2[last2];
        }
      cnt1[0] += zero;
      cnt2[0] += zero;
    }
    if (alast1 == 0) {
      for (int i = 9; i >= 0; --i) {
        for (int j = 1; j <= cnt1[i]; ++j) printf("%d", i);
      }
      puts("");
      for (int i = 9; i >= 0; --i) {
        for (int j = 1; j <= cnt2[i]; ++j) printf("%d", i);
      }
      puts("");
    } else {
      cnt1[0] -= azero;
      cnt2[0] -= azero;
      --cnt1[alast1];
      --cnt2[10 - alast1];
      for (int i = 0; i < 10; ++i) {
        for (int j = 1; j <= cnt1[i] - cnt2[9 - i]; ++j) printf("%d", i);
      }
      for (int i = 0; i < 10; ++i) {
        for (int j = 1; j <= cnt1[i] && j <= cnt2[9 - i]; ++j) printf("%d", i);
      }
      printf("%d", alast1);
      for (int j = 0; j < azero; ++j) printf("0");
      puts("");
      for (int i = 0; i < 10; ++i) {
        for (int j = 1; j <= cnt2[9 - i] - cnt1[i]; ++j) printf("%d", 9 - i);
      }
      for (int i = 0; i < 10; ++i) {
        for (int j = 1; j <= cnt1[i] && j <= cnt2[9 - i]; ++j)
          printf("%d", 9 - i);
      }
      printf("%d", 10 - alast1);
      for (int j = 0; j < azero; ++j) printf("0");
      puts("");
    }
  }
  return 0;
}