Codeforces Beta Round 99 (Div. 1)
B
Digits Permutations
Codeforces
1900
原题
← AC →
翻译中…

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 $10^{5}$. 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.

翻译中…

样例

Input #1
198
Output #1
981
819
InputCopy OutputCopy
Input #2
500
Output #2
500
500
InputCopy OutputCopy
题目信息
题号
138B
时间限制
1 s
内存限制
256 MB
标签
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。