406551: GYM102439 E Small business

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Small businesstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

A little girl named Julia has decided to open a toy store in the backyard. She decided to sell two types of goods: teddy bears and stuffed bunnies. As you know, every normal store has price tags for its goods. But Julia still can not write, although she is taking her first steps in business. That's why she decided to form price tags from her kids blocks with numbers using every single block, so that not one is lost. Julia is very kind and generous, so she decided that prices should form a minimum pair, should not be more than $$$10^{18}$$$, and even can be equal to zero. However, the girl doesn't like leading zeros, so they shouldn't be present on price tags. Let's support small business and help to form two price tags from the available blocks.

Input

The first and the only line contains a list of available blocks — string $$$s$$$ consisting of digits only. $$$$$$1 \le |s| \le 50 $$$$$$

Output

Output two price tags. Remember that the minimum pair is a pair where, firstly, the lower of the two prices is minimal, and, secondly, the other price is also the minimal possible for the given first one. If such price tags can't be formed, output «-1 -1».

ExamplesInput
123456
Output
1 23456
Input
42
Output
2 4
Input
000
Output
-1 -1

加入题单

上一题 下一题 算法标签: