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;
using namespace std;
template <class T>
ostream& operator<<(ostream& out, const vector<T>& data) {
  out << "[";
  for (int i = 0; i < (int)data.size(); ++i)
    out << data[i] << (i == data.size() - 1 ? "" : ",");
  out << "]";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const set<T>& s) {
  out << "{";
  for (typename set<T>::iterator itr = s.begin(); itr != s.end(); ++itr)
    out << *itr << " ";
  out << "}";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const multiset<T>& s) {
  out << "{";
  for (typename multiset<T>::iterator itr = s.begin(); itr != s.end(); ++itr)
    out << *itr << " ";
  out << "}";
  return out;
}
template <class T1, class T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& p) {
  out << "(" << p.first << "," << p.second << ")";
  return out;
}
template <class T1, class T2>
ostream& operator<<(ostream& out, const map<T1, T2>& m) {
  for (typename map<T1, T2>::const_iterator itr = m.begin(); itr != m.end();
       ++itr)
    out << itr->first << "->" << itr->second << " ";
  return out;
}
string line;
int N;
int ans;
string ans1, ans2;
void test(int x1, int x2, vector<int> cnt1, vector<int> cnt2) {
  string s1;
  string s2;
  cnt1[x1]--;
  cnt2[x2]--;
  for (int i = 0; i < 10; ++i) {
    if (cnt1[i] < 0) return;
    if (cnt2[i] < 0) return;
  }
  s1 = string(1, x1 + '0');
  s2 = string(1, x2 + '0');
  int nowans = 1;
  for (int i = 0; i <= 9; ++i) {
    int now = min(cnt1[i], cnt2[9 - i]);
    cnt1[i] -= now;
    cnt2[9 - i] -= now;
    s1 += string(now, '0' + i);
    s2 += string(now, '0' + 9 - i);
    nowans += now;
  }
  int now = min(cnt1[0], cnt2[0]);
  nowans += min(cnt1[0], cnt2[0]);
  s1 = string(now, '0') + s1;
  s2 = string(now, '0') + s2;
  cnt1[0] -= now;
  cnt2[0] -= now;
  for (int i = 0; i < 10; ++i) {
    s1 += string(cnt1[i], '0' + i);
    s2 += string(cnt2[i], '0' + i);
  }
  reverse(s1.begin(), s1.end());
  reverse(s2.begin(), s2.end());
  if (nowans > ans) {
    ans = nowans;
    ans1 = s1;
    ans2 = s2;
  }
}
void init() {
  cin >> line;
  vector<int> cnt(10, 0);
  N = (int)line.length();
  for (int i = 0; i < N; ++i) cnt[line[i] - '0']++;
  ans = cnt[0];
  ans1 = "";
  ans2 = "";
  for (int i = 1; i < 10; ++i) ans1 += string(cnt[i], '0' + i);
  ans1 += string(cnt[0], '0');
  ans2 = ans1;
  for (int i = 1; i <= 9; ++i) {
    int x1 = i;
    int x2 = 10 - i;
    vector<int> nowcnt = cnt;
    test(x1, x2, nowcnt, nowcnt);
  }
  cout << ans1 << endl;
  cout << ans2 << endl;
}
void york() {}
int main() {
  init();
  york();
  return 0;
}