#P14683. [ICPC 2025 Yokohama R] Decompose and Concatenate

[ICPC 2025 Yokohama R] Decompose and Concatenate

题目描述

You are given an integer greater than or equal to 2. When this number is decomposed into the sum of two positive integers, a new integer number can be formed as the concatenation of the decimal representations of the two integers. Find the maximum possible number formed in this way.

For example, 102 can be decomposed and concatenated as follows.

1+101  11011 + 101 \ \rightarrow \ 1101 2+100  21002 + 100 \ \rightarrow \ 2100 3+99  3993 + 99 \ \rightarrow \ 399 4+98  4984 + 98 \ \rightarrow \ 498 \vdots 101+1  1011101 + 1 \ \rightarrow \ 1011

Among them, 92+10  921092 + 10 \ \rightarrow \ 9210 is the largest.

输入格式

The input consists of a single test case in a single line. The line contains an integer between 22 and 101710^{17}, inclusive, which is the integer to be decomposed and concatenated.

输出格式

Output the maximum possible number in a line.

8
71
2025
10251000
102
9210
99999999999999999 
8999999999999999910000000000000000