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 typedef ll;
int binpow(int a, int n) {
  int res = 1;
  while (n) {
    if (n & 1) res *= a;
    a *= a;
    n >>= 1;
  }
  return res;
}
int main() {
  string s1;
  string s2;
  string s3;
  int mas1[10][11] = {};
  int mas2[10][11] = {};
  int i = 0;
  int j = 0;
  cin >> s1;
  for (int y = 1; y <= 9; y++) {
    for (i = 0; i < s1.length(); i++) {
      mas1[y][s1[i] - '0']++;
      mas2[y][s1[i] - '0']++;
    }
    mas1[y][10] = 0;
    mas2[y][10] = 0;
  }
  int d = 0;
  int maxi = 0;
  int count = 0;
  int ym = 1;
  string ans1, ans2;
  for (int y = 9; y > 0; y--) {
    for (i = y; i >= 0; i--) {
      if (mas1[y][i] > 0) {
        if (mas2[y][10 - i - d] > 0) {
          char a = i + '0';
          char b = 10 - i - d + '0';
          mas1[y][i]--;
          mas2[y][10 - i - d]--;
          ans1 += a;
          ans2 += b;
          d = 1;
          i = 10;
          count++;
        }
      }
    }
    d = 0;
    if (count > maxi) {
      maxi = count;
      s2.clear();
      s2 += ans1;
      s3.clear();
      s3 += ans2;
      ym = y;
    }
    count = 0;
    ans1.clear();
    ans2.clear();
  }
  i = 0;
  int x = min(mas1[ym][0], mas2[ym][0]);
  mas1[ym][0] -= x;
  mas2[ym][0] -= x;
  for (i = 0; i < 10; i++) {
    char a = i + '0';
    while (mas1[ym][i] > 0) {
      s2 += a;
      mas1[ym][i]--;
    }
    while (mas2[ym][i] > 0) {
      s3 += a;
      mas2[ym][i]--;
    }
  }
  reverse(s2.begin(), s2.end());
  reverse(s3.begin(), s3.end());
  while (x > 0) {
    s2 += '0';
    s3 += '0';
    x--;
  }
  cout << s2 << endl;
  cout << s3;
}