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 num1[20], num2[20];
int main() {
  string s;
  while (cin >> s) {
    string s1, s2;
    int len = s.length();
    memset(num1, 0, sizeof(num1));
    memset(num2, 0, sizeof(num2));
    for (int i = 0; i < len; i++) {
      num1[s[i] - '0']++;
      num2[s[i] - '0']++;
    }
    int f = -1, ans = 0;
    for (int i = 1; i <= 5; i++) {
      if (num1[i] && num2[10 - i]) {
        num1[i]--;
        num2[10 - i]--;
        int sum = 0;
        for (int j = 0; j <= 9; j++) {
          sum += min(num1[j], num2[9 - j]);
        }
        if (ans < sum + 1) {
          ans = sum + 1;
          f = i;
        }
        num1[i]++;
        num2[10 - i]++;
      }
    }
    if (f != -1) {
      num1[f]--;
      num2[10 - f]--;
      for (int i = 0; i <= 9; i++) {
        while (num1[i] && num2[9 - i]) {
          s1 += i + '0';
          s2 += 9 - i + '0';
          num1[i]--;
          num2[9 - i]--;
        }
      }
      s1 += f + '0';
      s2 += 10 - f + '0';
    }
    while (num1[0] && num2[0]) {
      s1 += '0';
      s2 += '0';
      num1[0]--;
      num2[0]--;
    }
    reverse(s1.begin(), s1.end());
    reverse(s2.begin(), s2.end());
    for (int i = 0; i <= 9; i++) {
      while (num1[i]) {
        s1 += i + '0';
        num1[i]--;
      }
      while (num2[i]) {
        s2 += i + '0';
        num2[i]--;
      }
    }
    reverse(s1.begin(), s1.end());
    reverse(s2.begin(), s2.end());
    cout << s1 << "\n" << s2 << endl;
  }
  return 0;
}