I'm trying to get the biggest number in a
string that is contained in numbers and operators randomly.
For example, -123456789 will be (98765432-1), 1234567890 will be (9876543210), 123*456+7 will be (765*432 + 1), and so on.
However, I have no idea how to split the operators and the numbers and find the operation that makes the biggest numbers.
This is a method to find and calculate the number.
And, what I'm trying to do is to make separated between operators and numbers using ArrayList above.
But, is it available to make the operations in this approach? I guess that I need to find the operations in a string without a split.
I know how to organize the numbers from the highest to the lowest in a string like below.
The quetsion is kind of messy, but could you provide some instructions how to approach?
Input
12356789
-123456789
123*456+7
Output
987654321
987665432-1 = ?
(765*432)+1 = ?