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 INF = 100000000;
double EPS = 1e-8;
string x, y;
vector<int> a, b, ca, cb;
bool carry(int c) {
  for (int i = 0; i < 10; ++i)
    if (a[i] && b[10 - c - i]) {
      x += i + '0';
      a[i]--;
      y += 10 - c - i + '0';
      b[10 - c - i]--;
      return true;
    }
  return false;
}
int solve(string s, int z) {
  x = y = "";
  a = ca, b = cb;
  int r = 0;
  if (a[z] && b[10 - z]) {
    x += z + '0';
    a[z]--;
    y += 10 - z + '0';
    b[10 - z]--;
    r++;
    while (carry(1)) r++;
  }
  int t = min(a[0], b[0]);
  x += string(a[0] - t, 0 + '0');
  y += string(b[0] - t, 0 + '0');
  for (int i = 1; i < 10; ++i) {
    x += string(a[i], i + '0');
    y += string(b[i], i + '0');
  }
  reverse((x).begin(), (x).end()), reverse((y).begin(), (y).end());
  x += string(t, '0');
  y += string(t, '0');
  return r;
}
void init(string &s) {
  ca.clear();
  ca.resize(10, 0);
  cb.clear();
  cb.resize(10, 0);
  for (int i = 0; i < (int)((s).size()); ++i) {
    ca[s[i] - '0'] = cb[s[i] - '0'] = ca[s[i] - '0'] + 1;
  }
}
int main() {
  string s;
  cin >> s;
  string r0 = s, r1 = s;
  int m = -1;
  init(s);
  for (int i = 1; i < 10; ++i) {
    int t = solve(s, i);
    if (t > m) {
      m = t;
      r0 = x;
      r1 = y;
    }
  }
  cout << r0 << endl << r1 << endl;
  return 0;
}