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;
int n[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int p[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
struct res {
  string s1, s2;
  int ans;
  res() {
    s1 = s2 = "";
    ans = 0;
  }
};
res maxi(vector<int> f1, vector<int> f2) {
  res ans;
  while (1) {
    bool ch = false;
    for (int i = int(0); i <= int(9); i++) {
      if (f1[n[i]] > 0 && f2[p[i]] > 0) {
        ans.s1 += char('0' + n[i]);
        ans.s2 += char('0' + p[i]);
        ans.ans++;
        f1[n[i]]--;
        f2[p[i]]--;
        ch = true;
      }
    }
    if (!ch) {
      for (int i = int(0); i <= int(9); i++) {
        while (f1[i] > 0) {
          ans.s1 += char('0' + i);
          f1[i]--;
        }
        while (f2[i] > 0) {
          ans.s2 += char('0' + i);
          f2[i]--;
        }
      }
      break;
    }
  }
  return ans;
}
int main() {
  string str;
  cin >> str;
  int len = str.length();
  vector<int> fre1, fre2;
  fre1.resize(10), fre2.resize(10);
  for (int i = int(0); i <= int(len - 1); i++) {
    fre1[str[i] - '0']++;
    fre2[str[i] - '0']++;
  }
  bool isans = false;
  struct res fin;
  for (int i = int(0); i <= int(8); i++) {
    vector<int> f1, f2;
    if (fre1[n[i + 1]] > 0 && fre2[p[i]] > 0) {
      struct res tmp;
      f1 = fre1;
      f2 = fre2;
      while (f1[0] > f1[9]) {
        tmp.s1 += '0';
        tmp.s2 += '0';
        f1[0]--;
        f2[0]--;
        tmp.ans++;
      }
      tmp.s1 += char(n[i + 1] + '0');
      tmp.s2 += char(p[i] + '0');
      tmp.ans++;
      f1[n[i + 1]]--;
      f2[p[i]]--;
      struct res k = maxi(f1, f2);
      tmp.s1 += k.s1;
      tmp.s2 += k.s2;
      tmp.ans = tmp.ans + k.ans;
      if (tmp.ans > fin.ans) {
        fin.ans = tmp.ans;
        fin.s1 = tmp.s1;
        fin.s2 = tmp.s2;
      }
    }
  }
  struct res tmp;
  tmp.ans = fre1[0];
  for (int i = int(0); i <= int(9); i++) {
    while (fre1[i] > 0) {
      tmp.s1 += char(i + '0');
      tmp.s2 += char(i + '0');
      fre1[i]--;
    }
  }
  if (tmp.ans >= fin.ans) {
    fin.ans = tmp.ans;
    fin.s1 = tmp.s1;
    fin.s2 = tmp.s2;
  }
  reverse(fin.s1.begin(), fin.s1.end());
  reverse(fin.s2.begin(), fin.s2.end());
  cout << fin.s1 << endl << fin.s2 << endl;
  return 0;
}