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 s[100015];
int ans, node, C[13], cnt[13], p1, p2, ar1[100015], ar2[100015], C1[13], C2[13],
    cnt1[13], cnt2[13];
int main() {
  int i, j, p, tmp;
  bool can;
  scanf("%s", &s);
  for (i = strlen(s) - 1; i >= 0; --i) ++C[s[i] - '0'];
  for (i = 1; i <= 5; ++i) {
    for (j = 0; j <= 9; ++j) cnt1[j] = cnt2[j] = C[j];
    if (cnt1[i] && cnt2[10 - i]) {
      p = 1;
      --cnt1[i];
      --cnt2[10 - i];
      if (cnt1[0] > max(cnt1[9], cnt2[9])) {
        p += cnt1[0] - max(cnt1[9], cnt2[9]);
        cnt1[0] = cnt2[0] = max(cnt1[9], cnt2[9]);
      }
      p += (min(cnt1[0], cnt2[9]) + min(cnt2[0], cnt1[9]) +
            min(cnt1[1], cnt2[8]) + min(cnt2[1], cnt1[8]) +
            min(cnt1[2], cnt2[7]) + min(cnt2[2], cnt1[7]) +
            min(cnt1[3], cnt2[6]) + min(cnt2[3], cnt1[6]) +
            min(cnt1[4], cnt2[5]) + min(cnt2[4], cnt1[5]));
      if (p > ans) {
        ans = p;
        node = i;
      }
    }
  }
  for (i = 0; i <= 9; ++i) C1[i] = C2[i] = C[i];
  if (node) {
    --C1[node], --C2[10 - node];
    if (C1[0] > max(C2[9], C1[9])) {
      p1 = p2 = C1[0] - max(C1[9], C2[9]);
      C1[0] = C2[0] = max(C1[9], C2[9]);
    }
    ar1[++p1] = node, ar2[++p2] = 10 - node;
    for (i = 0; i <= 9; ++i) {
      for (j = (p = min(C1[i], C2[9 - i])); j >= 1; --j) {
        ar1[++p1] = i;
        ar2[++p2] = 9 - i;
      }
      C1[i] -= p;
      C2[9 - i] -= p;
    }
    for (i = 0; i <= 9; ++i)
      for (j = 1; j <= C1[i]; ++j) ar1[++p1] = i;
    for (i = 9; i >= 0; --i)
      for (j = 1; j <= C2[i]; ++j) ar2[++p2] = i;
  } else {
    p1 = p2 = C[0];
    for (i = 1; i <= 9; ++i)
      for (j = 1; j <= C[i]; ++j) ar1[++p1] = i;
    for (i = 9; i >= 1; --i)
      for (j = 1; j <= C[i]; ++j) ar2[++p2] = i;
  }
  for (i = p1; i >= 1; --i) printf("%d", ar1[i]);
  printf("\n");
  for (i = p2; i >= 1; --i) printf("%d", ar2[i]);
  printf("\n");
  return 0;
}