Score : 1000 points
You are given a string S consisting of digits between 1
and 9
, inclusive.
You will insert at most K commas (,
) into this string to separate it into multiple numbers.
Your task is to minimize the maximum number among those produced by inserting commas. Find minimum possible such value.
1
and 9
, inclusive.The input is given from Standard Input in the following format:
K S
Print the minimum possible value.
2 15267315
315
When the string is separated into 152, 67 and 315, the maximum among these is 315, which is the minimum possible value.
0 12456174517653111
12456174517653111
12456174517653111 itself is the answer.
8 127356176351764127645176543176531763517635176531278461856198765816581726586715987216581
5317635176