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).
One line containing up to 13 non-space-separated digits.
Note: In Free Pascal, the
int64 type can be used to store
One line containing two non-space-separated integers: the number of different possible answers, followed by the lowest most probable answer.
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.
Point Value: 10
Time Limit: 2.00s
Memory Limit: 1024M
Added: Feb 22, 2011
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3