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 ans1, ans2, s;
int res, d[10], t[10], m1[10], m2[10], x, y;
int main() {
  cin >> s;
  for (int i = 0; i < (int)s.size(); i++) d[s[i] - '0']++;
  for (int i = 0; i < 10; i++) t[i] = d[i];
  for (int i = 9; i >= 0; i--)
    for (int j = 0; j < d[i]; j++) ans1 += char(i + '0'), ans2 += char(i + '0');
  for (int x = 1; x < 10; x++) {
    y = 10 - x;
    if (d[x] && t[y]) {
      int cnt = 1;
      d[x]--, t[y]--;
      for (int i = 0; i < 10; i++) cnt += min(d[i], t[9 - i]);
      if (cnt > res) {
        res = cnt;
        ans1.clear(), ans2.clear();
        ans1 += char(x + '0');
        ans2 += char(y + '0');
        for (int i = 0; i < 10; i++) m1[i] = d[i];
        for (int i = 0; i < 10; i++) m2[i] = t[i];
        for (int i = 0; i < 10; i++) {
          int k = min(d[i], t[9 - i]);
          m1[i] = d[i] - k;
          m2[9 - i] = t[9 - i] - k;
          for (int j = 0; j < k; j++)
            ans1 += char(i + '0'), ans2 += char((9 - i) + '0');
        }
        int cnt1 = 0, cnt2 = 0;
        for (int j = 1; j < 10; j++) {
          cnt1 += m1[j];
          cnt2 += m2[j];
          for (int q = 0; q < m1[j]; q++) ans1 += char(j + '0');
          for (int q = 0; q < m2[j]; q++) ans2 += char(j + '0');
        }
        if (cnt1 < cnt2)
          for (int i = 0; i < cnt2 - cnt1; i++) ans1 += '0', m1[0]--;
        else if (cnt1 > cnt2)
          for (int i = 0; i < cnt1 - cnt2; i++) ans2 += '0', m2[0]--;
        reverse(ans1.begin(), ans1.end());
        reverse(ans2.begin(), ans2.end());
        for (int i = 0; i < m1[0]; i++) ans1 += '0';
        for (int i = 0; i < m2[0]; i++) ans2 += '0';
      }
      d[x]++, t[y]++;
    }
  }
  cout << ans1 << endl << ans2;
  return 0;
}