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;
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T Dist(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2 * x1 - x2) + (y1 - y2 * y1 - y2));
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Chkbit(int N, int pos) { return (bool)(N & (1 << pos)); }
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
long long int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int a[12], b[12], c[12], d[12];
int Solve() {
  int ans = 1;
  for (int i = 0; i <= 9; i++) {
    int tp = 9 - i;
    while (b[i] && d[tp]) {
      ans++, b[i]--, d[tp]--;
    }
  }
  return ans;
}
int cnt;
void Prnt(int l, int r) {
  string A, B, C;
  A += (l + '0'), B += (r + '0');
  for (int i = 0; i <= 9; i++) {
    int tp = 9 - i;
    while (b[i] && d[tp]) {
      b[i]--, d[tp]--;
      A += (i + '0'), B += (tp + '0');
    }
  }
  while (b[0] > 0 && d[0] > 0) {
    C += '0';
    b[0]--;
    d[0]--;
  }
  B = C + B;
  A = C + A;
  for (int i = 0; i < 10; i++) {
    while (b[i] > 0) {
      A += (i + '0');
      b[i]--;
    }
  }
  for (int i = 0; i < 10; i++) {
    while (d[i] > 0) {
      B += (i + '0');
      d[i]--;
    }
  }
  reverse(A.begin(), A.end());
  reverse(B.begin(), B.end());
  cout << A << endl;
  cout << B << endl;
  return;
}
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    a[s[i] - '0']++;
  }
  for (int i = 0; i < 10; i++) c[i] = a[i];
  vector<int> v;
  int ans = -1;
  for (int i = 1; i <= 5; i++) {
    int tp = 10 - i;
    for (int j = 0; j < 10; j++) b[j] = a[j], d[j] = c[j];
    if (b[i] && d[tp]) {
      b[i]--;
      d[tp]--;
      ans = max(ans, Solve());
    }
  }
  for (int i = 1; i <= 5; i++) {
    int tp = 10 - i;
    for (int j = 0; j < 10; j++) b[j] = a[j], d[j] = c[j];
    if (b[i] && d[tp]) {
      b[i]--;
      d[tp]--;
      if (ans == Solve()) {
        for (int j = 0; j < 10; j++) b[j] = a[j], d[j] = c[j];
        b[i]--;
        d[tp]--;
        Prnt(i, tp);
        return 0;
      }
    }
  }
  sort(s.begin(), s.end(), greater<char>());
  cout << s << endl;
  cout << s << endl;
  return 0;
}