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;
long long int cnt[2][10];
string s0, s1;
long long int recur(long long int num0, long long int num1) {
  if (num0 == 10) return 0;
  long long int mini = min(cnt[0][num0], cnt[1][num1]);
  cnt[0][num0] -= mini;
  cnt[1][num1] -= mini;
  s0 += string(mini, '0' + num0);
  s1 += string(mini, '0' + num1);
  return recur(num0 + 1, num1 - 1) + mini;
}
int main() {
  string a;
  cin >> a;
  sort((a).begin(), (a).end());
  reverse((a).begin(), (a).end());
  long long int best = 0;
  pair<string, string> res = make_pair(a, a);
  for (long long int num0 = 1; num0 <= 5; num0++) {
    long long int num1 = 10 - num0;
    for (int i = 0; i < ((int)(10)); ++i)
      cnt[0][i] = cnt[1][i] = count((a).begin(), (a).end(), '0' + i);
    cnt[0][num0]--;
    cnt[1][num1]--;
    if (0 <= cnt[0][num0] && 0 <= cnt[1][num1]) {
      s0 = string(1, '0' + num0);
      s1 = string(1, '0' + num1);
      long long int t = recur(0, 9);
      long long int mini = min(cnt[0][0], cnt[1][0]);
      t += mini + 1;
      s0 = string(mini, '0') + s0;
      s1 = string(mini, '0') + s1;
      cnt[0][0] -= mini;
      cnt[1][0] -= mini;
      for (int i = 0; i < ((int)(10)); ++i) s0 += string(cnt[0][i], '0' + i);
      for (int i = 0; i < ((int)(10)); ++i) s1 += string(cnt[1][i], '0' + i);
      if (best < t) {
        best = t;
        reverse((s0).begin(), (s0).end());
        reverse((s1).begin(), (s1).end());
        res = make_pair(s0, s1);
      }
    }
    cnt[0][num0]++;
    cnt[1][num1]++;
  }
  cout << res.first << endl << res.second << endl;
}