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 ll = long long;
ll cnt[10], cnt1[10], cnt2[10];
int main() {
  std::string s;
  std::cin >> s;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    cnt[s[i] - '0']++;
    cnt1[s[i] - '0']++;
    cnt2[s[i] - '0']++;
  }
  std::stack<std::pair<int, int>> ans1, ans2;
  ll ma = -1;
  for (int m = 0; m <= cnt[0]; m++) {
    std::stack<std::pair<int, int>> a, b;
    a.emplace(0, m);
    b.emplace(0, m);
    cnt1[0] -= m;
    cnt2[0] -= m;
    ll t = m;
    for (int i = 1; i <= 5; i++) {
      int cnt11[10], cnt22[10];
      for (int k = 0; k < 10; k++) {
        cnt11[k] = cnt[k];
        cnt22[k] = cnt[k];
      }
      cnt11[0] -= m;
      cnt22[0] -= m;
      ll tt = m;
      std::stack<std::pair<int, int>> aa, bb;
      aa.emplace(0, m), bb.emplace(0, m);
      int j = 10 - i;
      if (cnt11[i] == 0 || cnt22[j] == 0) continue;
      aa.emplace(i, 1);
      bb.emplace(j, 1);
      cnt11[i]--;
      cnt22[j]--;
      tt++;
      for (int k = 0; k < 10; k++) {
        int l = 9 - k;
        int mi = std::min(cnt11[k], cnt22[l]);
        if (mi == 0) continue;
        tt += mi;
        aa.emplace(k, mi);
        bb.emplace(l, mi);
        cnt11[k] -= mi;
        cnt22[l] -= mi;
      }
      if (tt > t) {
        t = tt;
        a = aa;
        b = bb;
        for (int k = 0; k < 10; k++) {
          cnt1[k] = cnt11[k];
          cnt2[k] = cnt22[k];
        }
      }
    }
    for (int k = 0; k < 10; k++) {
      if (cnt1[k] != 0) {
        a.emplace(k, cnt1[k]);
      }
    }
    for (int k = 0; k < 10; k++) {
      if (cnt2[k] != 0) {
        b.emplace(k, cnt2[k]);
      }
    }
    if (t > ma) {
      ma = t;
      ans1 = a;
      ans2 = b;
    }
    for (int k = 0; k < 10; k++) {
      cnt1[k] = cnt[k];
      cnt2[k] = cnt[k];
    }
  }
  if (ma == -1) {
    std::cout << s << " " << s << std::endl;
    return 0;
  }
  while (!ans1.empty()) {
    auto p = ans1.top();
    std::cout << std::string(p.second, (char)('0' + p.first));
    ans1.pop();
  }
  std::cout << "\n";
  while (!ans2.empty()) {
    auto p = ans2.top();
    std::cout << std::string(p.second, (char)('0' + p.first));
    ans2.pop();
  }
  std::cout << "\n";
  return 0;
}