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 maxn = 4e5 + 10;
const int maxm = 500 * 500 + 10;
const int inf = 1e9;
const long long mod = 1e9 + 7;
int getint() {
  char c;
  while ((c = getchar()) && !(c >= '0' && c <= '9') && c != '-')
    ;
  int ret = c - '0', sgn = 0;
  if (c == '-') sgn = 1, ret = 0;
  while ((c = getchar()) && c >= '0' && c <= '9') ret = ret * 10 + c - '0';
  if (sgn) ret = -ret;
  return ret;
}
char s[maxn];
int a[maxn];
multiset<int> s1, s2;
vector<int> g, ans1, ans2;
multiset<int>::iterator it1, it2;
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    a[i] = s[i] - '0';
    s1.insert(a[i]);
    s2.insert(a[i]);
  }
  int x, y;
  int mx = -1;
  for (int d = 1; d <= 10; d++) {
    int flag = 0;
    int len0 = 0;
    g.clear();
    x = -1, y = -1;
    if ((s1.find(d) != s1.end()) && (s2.find(10 - d) != s2.end())) {
      s1.erase(s1.find(d));
      s2.erase(s2.find(10 - d));
      x = d, y = 10 - d;
      flag = 1;
    }
    int temp = 0;
    if (flag) temp++;
    for (int i = 0; i < len; i++) {
      if (s1.find(a[i]) == s1.end()) continue;
      if (s2.find(9 - a[i]) != s2.end()) {
        g.push_back(a[i]);
        s1.erase(s1.find(a[i]));
        s2.erase(s2.find(9 - a[i]));
        if (flag) temp++;
      } else if (a[i] == 0 && s2.find(0) != s2.end()) {
        len0++;
        s1.erase(s1.find(0));
        s2.erase(s2.find(0));
      }
    }
    if (temp > mx) {
      mx = temp;
      ans1.clear(), ans2.clear();
      for (int i = 1; i <= len0; i++) ans1.push_back(0), ans2.push_back(0);
      if (x != -1) ans1.push_back(x), ans2.push_back(10 - x);
      for (int i = 0; i < (g.size()); i++)
        ans1.push_back(g[i]), ans2.push_back(9 - g[i]);
      it1 = s1.begin();
      while (it1 != s1.end()) ans1.push_back((*it1)), it1++;
      it2 = s2.begin();
      while (it2 != s2.end()) ans2.push_back((*it2)), it2++;
    }
    s1.clear();
    s2.clear();
    for (int i = 0; i < len; i++) s1.insert(a[i]), s2.insert(a[i]);
  }
  for (int i = len - 1; i >= 0; i--) {
    cout << ans1[i];
  }
  cout << endl;
  for (int i = len - 1; i >= 0; i--) {
    cout << ans2[i];
  }
  cout << endl;
  return 0;
}