Non-space-separated

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 Format

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

Note: In Free Pascal, the int64 type can be used to store 13-digit numbers.

Output Format

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.

All Submissions
Best Solutions


Point Value: 10
Time Limit: 2.00s
Memory Limit: 1024M
Added: Feb 22, 2011
Author: SourSpinach

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

It's quiet in here...