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;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int cnt[11], tp1[11], tp2[11];
char ans[2][100010], tmp[2][100010], s[100010];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  strcpy(ans[0], s), strcpy(ans[1], s);
  for (int i = 0; i < n; i++) cnt[s[i] - '0']++;
  int ansv = cnt[0], lt = 0;
  for (int i = 0; i < n; i++)
    if (s[i] != '0') ans[0][lt++] = s[i];
  for (int i = 0; i < cnt[0]; i++) ans[0][lt++] = '0';
  ans[0][lt] = '\0';
  strcpy(ans[1], ans[0]);
  for (int i = 1, j; i < 6; i++)
    if (cnt[i] && cnt[10 - i]) {
      for (j = 0; j < 10; j++) tp1[j] = tp2[j] = cnt[j];
      int tmpv = 1, k = 0;
      int l1 = 0, l2 = 0;
      tmp[0][l1++] = i + '0', tmp[1][l2++] = 10 - i + '0', tp1[i]--,
      tp2[10 - i]--;
      while (1) {
        while (k < 10 && (!tp1[k] || !tp2[9 - k])) k++;
        if (k == 10) break;
        tmpv++, tp1[k]--, tp2[9 - k]--;
        tmp[0][l1++] = k + '0', tmp[1][l2++] = 9 - k + '0';
      }
      int mt = min(tp1[0], tp2[0]);
      tmpv += mt, tp1[0] -= mt, tp2[0] -= mt;
      if (tmpv > ansv) {
        for (j = 0; j < 10; j++)
          while ((tp1[j]--) > 0) tmp[0][l1++] = j + '0';
        for (j = 0; j < 10; j++)
          while ((tp2[j]--) > 0) tmp[1][l2++] = j + '0';
        reverse(tmp[0], tmp[0] + l1);
        reverse(tmp[1], tmp[1] + l2);
        for (int j = 0; j < mt; j++) tmp[0][l1++] = '0', tmp[1][l2++] = '0';
        tmp[0][l1] = tmp[1][l2] = '\0';
        ansv = tmpv, strcpy(ans[0], tmp[0]), strcpy(ans[1], tmp[1]);
      }
    }
  printf("%s\n%s\n", ans[0], ans[1]);
  return 0;
}