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;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  int fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
string str;
int cnt1[10], cnt2[10];
int match[10];
vector<int> ans1, ans2;
signed main() {
  cin >> str;
  for (int i = 0; i < str.size(); ++i) {
    cnt1[str[i] - '0']++;
    cnt2[str[i] - '0']++;
  }
  for (int i = 0; i <= 9; ++i) {
    match[i] = min(cnt1[i], cnt2[9 - i]);
    cnt1[i] -= match[i];
    cnt2[9 - i] -= match[i];
  }
  int cur = -1;
  for (int i = 1; i <= 9; ++i)
    if (cnt1[i] > 0 && cnt2[10 - i] > 0) {
      cur = i;
      break;
    }
  if (cur == -1) {
    for (int i = 1; i <= 9; ++i)
      if (cnt1[i] > 0 && match[i - 1] > 0) {
        match[i - 1]--;
        cnt1[i - 1]++;
        cnt2[10 - i]++;
        cur = i;
        break;
      } else if (match[i] > 0 && cnt2[10 - i] > 0) {
        match[i]--;
        cnt1[i]++;
        cnt2[9 - i]++;
        cur = i;
        break;
      } else if (match[i] > 0 && match[i - 1] > 0) {
        match[i]++;
        match[i - 1]++;
        cnt1[i]++;
        cnt1[i - 1]++;
        cnt2[9 - i]++;
        cnt2[10 - i]++;
        cur = i;
        break;
      }
  }
  while (cnt1[0] > 0 && cnt2[0] > 0) {
    ans1.push_back(0);
    ans2.push_back(0);
    cnt1[0]--;
    cnt2[0]--;
  }
  if (cur != -1) {
    ans1.push_back(cur);
    ans2.push_back(10 - cur);
    cnt1[cur]--;
    cnt2[10 - cur]--;
  }
  for (int i = 0; i <= 9; ++i) {
    for (int j = 1; j <= match[i]; ++j) {
      ans1.push_back(i);
      ans2.push_back(9 - i);
    }
  }
  int id1 = 0, id2 = 0;
  while (1) {
    while (id1 <= 9 && cnt1[id1] == 0) id1++;
    while (id2 <= 9 && cnt2[id2] == 0) id2++;
    if (id1 == 10) break;
    ans1.push_back(id1);
    ans2.push_back(id2);
    cnt1[id1]--;
    cnt2[id2]--;
  }
  for (int i = ans1.size() - 1; i >= 0; --i) cout << ans1[i];
  cout << endl;
  for (int i = ans2.size() - 1; i >= 0; --i) cout << ans2[i];
  cout << endl;
  return 0;
}