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 N = 100000;
int a[N];
int b[N];
char resA[N + 1];
char resB[N + 1];
int calc(int digit, int& zeroes) {
  int za = a[0], zb = b[0];
  int res = za;
  zeroes = za;
  if (a[digit] && b[10 - digit]) {
    a[digit]--;
    b[10 - digit]--;
    res = 1;
    for (int i = 0; i < 10; i++) {
      int lo = min(a[i], b[9 - i]);
      res += lo;
      if (i == 0) za -= lo;
      if (i == 9) zb -= lo;
    }
    zeroes = min(za, zb);
    res += zeroes;
    a[digit]++;
    b[10 - digit]++;
  }
  return res;
}
void print(int digit, int zeroes, int n) {
  char* pa = &resA[n];
  char* pb = &resB[n];
  *pa-- = 0;
  *pb-- = 0;
  while (zeroes--) a[0]--, b[0]--, *pa-- = '0', *pb-- = '0';
  if (a[digit] && b[10 - digit]) {
    *pa-- = '0' + digit, *pb-- = '0' + 10 - digit;
    a[digit]--;
    b[10 - digit]--;
    for (int i = 0; i < 10; i++) {
      int lo = min(a[i], b[9 - i]);
      a[i] -= lo;
      b[9 - i] -= lo;
      for (int j = 0; j < lo; j++) *pa-- = '0' + i, *pb-- = '0' + 9 - i;
    }
  }
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < a[i]; j++) *pa-- = '0' + i;
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < b[i]; j++) *pb-- = '0' + i;
  cout << resA << endl << resB << endl;
}
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    a[s[i] - '0']++;
    b[s[i] - '0']++;
  }
  int best = -1;
  int pick = -1;
  int zeroes = 0;
  for (int i = 1; i < 10; i++) {
    int z;
    int res = calc(i, z);
    if (res > best) best = res, pick = i, zeroes = z;
  }
  print(pick, zeroes, s.size());
  return 0;
}