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>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint();
char rch();
long long rlong();
int orig[10];
string origs;
string make(int *a, int numz, vector<int> s, int seed) {
  vector<char> c;
  for (int d = 0; d <= 9; d++)
    for (int i = 0; i < a[d]; i++) c.push_back('0' + d);
  reverse(s.begin(), s.end());
  for (auto &w : s) c.push_back('0' + w);
  for (int i = 0; i < numz; i++) c.push_back('0');
  ;
  return string(c.begin(), c.end());
}
int a[10], b[10];
pair<int, pair<string, string> > f(int seed) {
  memcpy(a, orig, sizeof a);
  memcpy(b, orig, sizeof b);
  int oppseed = 10 - seed;
  if (a[seed] <= 0 || b[oppseed] <= 0) return make_pair(-1, make_pair("", ""));
  vector<int> s, t;
  a[seed]--;
  s.push_back(seed);
  b[oppseed]--;
  t.push_back(oppseed);
  int ans = 1;
  for (int d = 0; d <= 9; d++) {
    int take = min(a[d], b[9 - d]);
    for (int i = 0; i < take; i++) {
      s.push_back(d);
      t.push_back(9 - d);
    }
    a[d] -= take;
    b[9 - d] -= take;
    ans += take;
  }
  int numz = min(a[0], b[0]);
  a[0] -= numz;
  b[0] -= numz;
  ans += numz;
  string ss = make(a, numz, s, seed);
  string tt = make(b, numz, t, oppseed);
  return make_pair(ans, make_pair(ss, tt));
}
pair<int, pair<string, string> > g() {
  string s = origs, t = origs;
  sort(s.begin(), s.end(), greater<char>());
  sort(t.begin(), t.end(), greater<char>());
  return make_pair(orig[0], make_pair(s, t));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> origs;
  for (auto &w : origs) orig[w - '0']++;
  pair<int, pair<string, string> > final = g();
  for (int seed = 1; seed <= 9; seed++) chkmax(final, f(seed));
  cout << final.second.first << "\n" << final.second.second << "\n";
}
static char stdinBuffer[1024];
static char *stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char *stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}