Non-space-separated

View as PDF

Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 1G

Author:
Problem type

Capba is wracking his brain over a particularly challenging programming problem: given several integers on a line, find their sum. Difficult as that is, Capba has found that the problem creator forgot to put any spaces in the input! Luckily, though, he has gotten his hands on the official input file.

At this point, Capba is interested in two things. Firstly, to determine his chances of being correct, he wants to know how many different answers are possible. Secondly, to make his attempt at an accepted solution, he wants to find the most probable answer – that is, the one which can be obtained by adding space in the largest number of ways. If there are multiple such answers, he's only interested in the lowest one (to save energy on typing).

Input Specification

One line containing up to 13 non-space-separated digits.

Output Specification

One line containing two non-space-separated integers: the number of different possible answers, followed by the lowest most probable answer.

Sample Input

1201

Sample Output

64

Explanation

The following answers are possible:

1+2+0+1 = 4
1+2+01  = 4
12+0+1  = 13
12+01   = 13
1+20+1  = 22
120+1   = 121
1+201   = 202
1201    = 1201

There are 6 different answers above, and the lowest one appearing twice is 4.


Comments

There are no comments at the moment.