100 atcoder#ABC221C. [ABC221C] Select Mul
[ABC221C] Select Mul
Score : points
Problem Statement
You are given an integer . Consider permuting the digits in and separate them into two positive integers.
For example, for the integer , there are six ways to separate it, as follows:
- and ,
- and ,
- and ,
- and ,
- and ,
- and .
Here, the two integers after separation must not contain leading zeros. For example, it is not allowed to separate the integer into and . Additionally, since the resulting integers must be positive, it is not allowed to separate into and , either.
What is the maximum possible product of the two resulting integers, obtained by the optimal separation?
Constraints
- is an integer between and (inclusive).
- contains two or more digits that are not .
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible product of the two integers after separation.
123
63
As described in Problem Statement, there are six ways to separate it:
- and ,
- and ,
- and ,
- and ,
- and ,
- and .
The products of these pairs, in this order, are , , , , , , with being the maximum.
1010
100
There are two ways to separate it:
- and ,
- and .
In either case, the product is .
998244353
939337176