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>
const long long oo = 0x3f3f3f3f;
const int _cnt = 1000 * 1000;
const int _p = 1000 * 1000 * 1000 + 7;
long long o(long long x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
using namespace std;
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
string st, s = "", t = "", s0 = "", t0 = "";
int a[15], l = 0, ans = 0, p, x, b[15], c[15], b0[15], c0[15], yyy = 0;
int main() {
  cin >> st;
  l = st.length();
  for (int i = 0; i <= l + 10; i++) s += ' ';
  for (int i = 0; i < l; i++) a[st[i] - '0']++;
  for (int i = 1; i <= 5; i++) {
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    s = "";
    t = "";
    if (a[i] == 0 || a[10 - i] == 0) continue;
    b[i]++;
    c[10 - i]++;
    for (int j = 0; j <= 9; j++) {
      int k = ((a[j] - b[j]) < (a[9 - j] - c[9 - j]) ? (a[j] - b[j])
                                                     : (a[9 - j] - c[9 - j]));
      for (int e = 1; e <= k; e++) {
        s += (j + '0');
        t += (9 - j + '0');
      }
      b[j] += k;
      c[9 - j] += k;
    }
    s += (i + '0');
    t += (10 - i + '0');
    int yy = ((a[0] - b[0]) < (a[0] - c[0]) ? (a[0] - b[0]) : (a[0] - c[0]));
    if (s.length() + yy > ans) {
      ans = s.length() + yy;
      s0 = s;
      t0 = t;
      yyy = yy;
      for (int j = 0; j <= 9; j++) b0[j] = b[j];
      for (int j = 0; j <= 9; j++) c0[j] = c[j];
    }
  }
  for (int i = 0; i <= 9; i++) b0[i] = a[i] - b0[i];
  for (int i = 0; i <= 9; i++) c0[i] = a[i] - c0[i];
  b0[0] -= yyy;
  c0[0] -= yyy;
  for (int i = 9; i >= 0; i--)
    for (int j = 1; j <= b0[i]; j++) printf("%d", i);
  cout << s0;
  for (int i = 1; i <= yyy; i++) printf("0");
  printf("\n");
  for (int i = 9; i >= 0; i--)
    for (int j = 1; j <= c0[i]; j++) printf("%d", i);
  cout << t0;
  for (int i = 1; i <= yyy; i++) printf("0");
  printf("\n");
  return 0;
}