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;
const int size = 100008;
char str[size];
int h[12], h1[12], h2[12];
inline int min(int a, int b) { return a > b ? b : a; }
string ansa, ansb;
int main(int argc, char** argv) {
  while (scanf("%s", str) != EOF) {
    int n = strlen(str);
    int max0 = -1;
    memset(h, 0, sizeof(h));
    for (int i = 0; i < n; i++) h[str[i] - '0']++;
    for (int i = 1; i < 10; i++) {
      copy(h, h + 10, h1);
      copy(h, h + 10, h2);
      string s1 = "", s2 = "";
      int num0 = 0;
      if (h1[i] > 0 && h2[10 - i] > 0) {
        num0++;
        s1 += '0' + i;
        s2 += '0' + 10 - i;
        h1[i]--, h2[10 - i]--;
        for (int j = 0; j < 10; j++) {
          int tmp = min(h1[j], h2[9 - j]);
          num0 += tmp;
          h1[j] -= tmp, h2[9 - j] -= tmp;
          s1 += string(tmp, '0' + j);
          s2 += string(tmp, '0' + 9 - j);
        }
      }
      if (h1[0] > 0 && h2[0] > 0) {
        int tmp = min(h1[0], h2[0]);
        num0 += tmp;
        h1[0] -= tmp, h2[0] -= tmp;
        s1 = string(tmp, 0 + '0') + s1;
        s2 = string(tmp, 0 + '0') + s2;
      }
      for (int i = 0; i < 10; i++) {
        s1 += string(h1[i], i + '0');
        s2 += string(h2[i], i + '0');
      }
      if (num0 > max0) {
        max0 = num0;
        ansa = s1, ansb = s2;
      }
    }
    reverse(ansa.begin(), ansa.end());
    reverse(ansb.begin(), ansb.end());
    cout << ansa << endl << ansb << endl;
  }
  return (EXIT_SUCCESS);
}