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;
char line[131072];
int cnt[11];
int tc1[11];
int tc2[11];
int use[11];
int n;
int p1[131072];
int p2[131072];
int best1[131072];
int best2[131072];
bool cmp(int x, int y) { return x > y; }
int findout(int num) {
  if (cnt[num] == 0 || cnt[10 - num] == 0) return 0;
  int ans = 1;
  memcpy(tc1, cnt, 44);
  memcpy(tc2, cnt, 44);
  tc1[num]--;
  tc2[10 - num]--;
  for (int i = 0; i < 10; i++) {
    use[i] = min(tc1[i], tc2[9 - i]);
    ans += use[i] * 2;
  }
  ans += tc1[0] - max(use[0], use[9]);
  int now = n;
  for (int i = 0; i < tc1[0] - max(use[0], use[9]); i++)
    p1[now - i] = p2[now - i] = 0;
  now -= tc1[0] - max(use[0], use[9]);
  p1[now] = num, p2[now] = 10 - num;
  now--;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < use[i]; j++) p1[now - j] = i, p2[now - j] = 9 - i;
    now -= use[i];
  }
  int bnow = now;
  for (int i = 1; i <= 9; i++) {
    for (int j = 0; j < tc1[i] - use[i]; j++) p1[now - j] = i;
    now -= tc1[i] - use[i];
  }
  now = bnow;
  for (int i = 1; i <= 9; i++) {
    for (int j = 0; j < tc2[i] - use[9 - i]; j++) p2[now - j] = i;
    now -= tc2[i] - use[9 - i];
  }
  return ans;
}
int main() {
  memset(cnt, 0, sizeof(cnt));
  gets(line + 1);
  n = strlen(line + 1);
  for (int i = 1; i <= n; i++) cnt[line[i] - 48]++;
  int ans = 0;
  for (int i = 1; i <= n; i++) best1[i] = best2[i] = line[i] - 48;
  sort(best1 + 1, best1 + 1 + n, cmp);
  sort(best2 + 1, best2 + 1 + n, cmp);
  for (int i = 1; i <= 5; i++) {
    int tmp = findout(i);
    if (tmp > ans) {
      ans = tmp;
      memcpy(best1, p1, sizeof(p1));
      memcpy(best2, p2, sizeof(p2));
    }
  }
  for (int i = 1; i <= n; i++) printf("%d", best1[i]);
  printf("\n");
  for (int i = 1; i <= n; i++) printf("%d", best2[i]);
  printf("\n");
  return 0;
}