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;
string s;
int cnt[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> s;
  n = (int)s.size();
  for (int i = 0; i < n; i++) {
    cnt[s[i] - '0']++;
  }
  int ans = cnt[0];
  pair<int, int> p;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      if (i + j != 10 || cnt[i] == 0 || cnt[j] == 0) continue;
      int ret = 1;
      int c1[10], c2[10];
      for (int k = 0; k < 10; k++) c1[k] = c2[k] = cnt[k];
      c1[i]--;
      c2[j]--;
      int r = min(c1[0], c2[9]);
      c1[0] -= r;
      c2[9] -= r;
      ret += r;
      r = min(c1[9], c2[0]);
      c1[9] -= r;
      c2[0] -= r;
      ret += r;
      r = min(c1[0], c2[0]);
      ret += r;
      c1[0] -= r;
      c2[0] -= r;
      for (int k = 1; k <= 8; k++) {
        r = min(c1[k], c2[9 - k]);
        ret += r;
        c1[k] -= r;
        c2[9 - k] -= r;
      }
      ans = max(ans, ret);
      if (ans == ret) p = make_pair(i, j);
    }
  }
  if (ans == cnt[0]) {
    string ans;
    for (int i = 9; i >= 0; i--) {
      for (int k = 0; k < cnt[i]; k++) {
        char ch = '0' + i;
        ans += ch;
      }
    }
    cout << ans << endl;
    cout << ans << endl;
    return 0;
  }
  deque<char> ans1, ans2;
  int i = p.first, j = p.second;
  int c1[10], c2[10];
  for (int k = 0; k < 10; k++) c1[k] = c2[k] = cnt[k];
  c1[i]--;
  c2[j]--;
  char ch = i + '0';
  ans1.push_back(i + '0');
  ch = j + '0';
  ans2.push_back(j + '0');
  int r = min(c1[9], c2[0]);
  c1[9] -= r;
  c2[0] -= r;
  for (int k = 0; k < r; k++) {
    ans1.push_back(9 + '0');
    ans2.push_back(0 + '0');
  }
  r = min(c1[0], c2[9]);
  c1[0] -= r;
  c2[9] -= r;
  for (int k = 0; k < r; k++) {
    ans1.push_back(0 + '0');
    ans2.push_back(9 + '0');
  }
  r = min(c1[0], c2[0]);
  c1[0] -= r;
  c2[0] -= r;
  for (int k = 0; k < r; k++) {
    ans1.push_front(0 + '0');
    ans2.push_front(0 + '0');
  }
  for (int k = 1; k <= 8; k++) {
    r = min(c1[k], c2[9 - k]);
    c1[k] -= r;
    c2[9 - k] -= r;
    for (int l = 0; l < r; l++) {
      ans1.push_back(k + '0');
      ans2.push_back(9 - k + '0');
    }
  }
  for (int k = 0; k <= 9; k++) {
    for (int l = 0; l < c1[k]; l++) ans1.push_back(k + '0');
    for (int l = 0; l < c2[k]; l++) ans2.push_back(k + '0');
  }
  for (i = n - 1; i >= 0; i--) cout << ans1[i];
  cout << endl;
  for (i = n - 1; i >= 0; i--) cout << ans2[i];
  cout << endl;
  return 0;
}