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;
const int MAXL = 100007;
char s[MAXL];
int a[10], b[10];
pair<int, pair<string, string> > answer;
int main() {
  gets(s);
  int l = strlen(s);
  if (l == 1) {
    puts(s);
    return 0;
  }
  sort(s, s + l);
  for (answer.first = 0; s[answer.first] == '0' && answer.first < l;
       answer.first++)
    ;
  reverse(s, s + l);
  answer.second = make_pair(s, s);
  for (int x = 1; x < 10; x++) {
    memset(a, 0, sizeof(a));
    for (int i = 0; i < l; i++) a[s[i] - '0']++;
    for (int i = 0; i < 10; i++) b[i] = a[i];
    if (a[x] && b[10 - x]) {
      string A, B;
      A.reserve(l);
      B.reserve(l);
      A = B = "";
      a[x]--;
      b[10 - x]--;
      A += x + '0';
      B += (10 - x) + '0';
      int k = 1;
      for (int i = 0; i < 10; i++)
        while (a[i] && b[9 - i]) {
          A += i + '0';
          B += (9 - i) + '0';
          k++;
          a[i]--;
          b[9 - i]--;
        }
      for (int j = 1; j < 10; j++)
        while (a[j]--) A += j + '0';
      for (int j = 1; j < 10; j++)
        while (b[j]--) B += j + '0';
      int d = min(a[0], b[0]);
      while (a[0] > d) A += '0', a[0]--;
      while (b[0] > d) B += '0', b[0]--;
      k += d;
      reverse(A.begin(), A.end());
      reverse(B.begin(), B.end());
      while (a[0]--) A += '0';
      while (b[0]--) B += '0';
      pair<int, pair<string, string> > curr = make_pair(k, make_pair(A, B));
      if (curr > answer) answer = curr;
    }
  }
  printf("%s\n%s\n", answer.second.first.c_str(), answer.second.second.c_str());
  return 0;
}