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 N = 100005;
char s[N];
int cnt[2][2][10];
int main() {
  while (~scanf("%s", s)) {
    memset(cnt, 0, sizeof(cnt));
    int lens = strlen(s);
    for (int i = (0); i < (lens); ++i)
      for (int j = (0); j < (2); ++j)
        for (int k = (0); k < (2); ++k) ++cnt[j][k][s[i] - '0'];
    int Max = 0, p = -1;
    for (int i = (1); i < (10); ++i) {
      for (int a = (0); a < (10); ++a)
        for (int b = (0); b < (2); ++b) cnt[1][b][a] = cnt[0][b][a];
      if (cnt[1][0][i] == 0 || cnt[1][1][10 - i] == 0) continue;
      int res = 1;
      --cnt[1][0][i];
      --cnt[1][1][10 - i];
      for (int j = (0); j < (10); ++j) {
        int t = min(cnt[1][0][j], cnt[1][1][9 - j]);
        res += t;
        cnt[1][0][j] -= t;
        cnt[1][1][9 - j] -= t;
      }
      res += min(cnt[1][0][0], cnt[1][1][0]);
      if (res > Max) {
        Max = res;
        p = i;
      }
    }
    if (p == -1) {
      int t = min(cnt[0][0][0], cnt[0][1][0]);
      cnt[0][0][0] -= t;
      cnt[0][1][0] -= t;
      string ans1 = "", ans2 = "";
      while (t--) {
        ans1 = ans1 + string(1, '0');
        ans2 = ans2 + string(1, '0');
      }
      for (int j = (0); j < (10); ++j) {
        while (cnt[0][0][j]--) {
          ans1 = string(1, j + '0') + ans1;
        }
      }
      for (int j = (0); j < (10); ++j) {
        while (cnt[0][1][j]--) {
          ans2 = string(1, j + '0') + ans2;
        }
      }
      cout << ans1 << endl << ans2 << endl;
      continue;
    }
    char c1 = p + '0', c2 = 10 - p + '0';
    string ans1 = "" + string(1, c1), ans2 = "" + string(1, c2);
    int i = p;
    for (int a = (0); a < (10); ++a)
      for (int b = (0); b < (2); ++b) cnt[1][b][a] = cnt[0][b][a];
    --cnt[1][0][i];
    --cnt[1][1][10 - i];
    for (int j = (0); j < (10); ++j) {
      int t = min(cnt[1][0][j], cnt[1][1][9 - j]);
      cnt[1][0][j] -= t;
      cnt[1][1][9 - j] -= t;
      while (t--) {
        ans1 = string(1, j + '0') + ans1;
        ans2 = string(1, 9 - j + '0') + ans2;
      }
    }
    int t = min(cnt[1][0][0], cnt[1][1][0]);
    cnt[1][0][0] -= t;
    cnt[1][1][0] -= t;
    while (t--) {
      ans1 = ans1 + string(1, '0');
      ans2 = ans2 + string(1, '0');
    }
    for (int j = (0); j < (10); ++j) {
      while (cnt[1][0][j]--) {
        ans1 = string(1, j + '0') + ans1;
      }
    }
    for (int j = (0); j < (10); ++j) {
      while (cnt[1][1][j]--) {
        ans2 = string(1, j + '0') + ans2;
      }
    }
    cout << ans1 << endl << ans2 << endl;
  }
  return 0;
}