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 frc[2][11];
int init[11];
void test() {
  string s;
  cin >> s;
  for (auto i : s) init[i - '0']++;
  sort(s.rbegin(), s.rend());
  int n = 0;
  while (s[s.size() - n - 1] == '0') n++;
  pair<int, pair<string, string>> ans = {n, {s, s}};
  for (int i = 1; i <= 9; i++) {
    for (int i = 0; i <= 10; i++) frc[0][i] = frc[1][i] = init[i];
    if (frc[0][i] && frc[1][10 - i]) {
      string ansa, ansb;
      int nr = 1;
      ansa += i + '0', ansb += 10 - i + '0', frc[0][i]--, frc[1][10 - i]--;
      for (int i = 0; i <= 9; i++)
        while (frc[0][i] && frc[1][9 - i])
          ansa += i + '0', ansb += 9 - i + '0', frc[0][i]--, frc[1][9 - i]--,
              nr++;
      int nr0 = min(frc[0][0], frc[1][0]);
      frc[0][0] -= nr0, frc[1][0] -= nr0;
      nr += nr0;
      string zr;
      while (nr0--) zr += "0";
      for (int i = 0; i <= 9; i++) {
        while (frc[0][i]) ansa += i + '0', frc[0][i]--;
        while (frc[1][i]) ansb += i + '0', frc[1][i]--;
      }
      reverse(ansa.begin(), ansa.end());
      reverse(ansb.begin(), ansb.end());
      ans = max(ans, {nr, {ansa + zr, ansb + zr}});
    }
  }
  cout << ans.second.first << ' ' << ans.second.second << '\n';
}
int main() {
  test();
  return 0;
}