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 comment(linker, "/STACK:20000000")
using namespace std;
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
long long rll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
char s[100500];
int cnt1[15];
int cnt2[15];
char s1[100500];
char s2[100500];
pair<int, int> ind;
int M = -1;
int RR = 0;
int U = -1;
int check() {
  int ans = 0;
  for (int i = (int)(0); i <= (int)(9); i++) {
    int T = 0;
    T = min(cnt1[i], cnt2[9 - i]);
    if (!i) U = T;
    ans += T;
  }
  return ans;
}
void GO() {
  for (int i = (int)(1); i <= (int)(9); i++)
    if (cnt1[i] && cnt2[10 - i]) {
      cnt1[i]--;
      cnt2[10 - i]--;
      int a = min(cnt1[0], cnt2[0]);
      int T = check();
      if (T > M) {
        M = T;
        RR = U;
        ind.first = i;
        ind.second = 10 - i;
      }
      cnt1[i]++;
      cnt2[10 - i]++;
    }
}
void solve() {
  gets(s);
  int len = strlen(s);
  for (int i = (int)(0); i <= (int)(len - 1); i++) cnt1[s[i] - '0']++;
  for (int i = (int)(0); i <= (int)(14); i++) cnt2[i] = cnt1[i];
  GO();
  bool wtf = false;
  int BUF = cnt1[0] - RR;
  for (int i = (int)(len - 1); i >= (int)(0); i--) {
    if (BUF) {
      BUF--;
      cnt1[0]--;
      cnt2[0]--;
      s1[i] = '0';
      s2[i] = '0';
    } else {
      if (!wtf) {
        if (M != -1) {
          wtf = true;
          s1[i] = '0' + ind.first;
          s2[i] = '0' + ind.second;
          cnt1[ind.first]--;
          cnt2[ind.second]--;
          continue;
        }
      } else {
        bool w = false;
        for (int j = (int)(0); j <= (int)(9); j++)
          if (cnt1[j] && cnt2[9 - j]) {
            w = true;
            s1[i] = '0' + j;
            s2[i] = '0' + 9 - j;
            cnt1[j]--;
            cnt2[9 - j]--;
            break;
          }
        if (w) continue;
      }
      for (int j = (int)(0); j <= (int)(9); j++)
        if (cnt1[j]) {
          s1[i] = '0' + j;
          cnt1[j]--;
          break;
        }
      for (int j = (int)(0); j <= (int)(9); j++)
        if (cnt2[j]) {
          s2[i] = '0' + j;
          cnt2[j]--;
          break;
        }
    }
  }
  puts(s1);
  puts(s2);
}
int main() {
  solve();
  return 0;
}