#P6509. [COCI2007-2008] JEDNAKOST
[COCI2007-2008] JEDNAKOST
Problem Description
You are given a string of the form A=B, where both and are positive integers with no leading zeros. Insert plus signs between some adjacent digits of . The goal is to use as few plus signs as possible so that the equation becomes true.
After inserting plus signs into , each addend is allowed to have multiple leading zeros, including . That is, numbers of the form are allowed as addends.
The testdata guarantees that a solution exists.
Input Format
The input consists of a single line containing a string of the form A=B, representing the given equation.
Output Format
This problem has a Special Judge.
Output one line containing a string representing a valid equation after inserting plus signs.
143175=120
14+31+75=120
5025=30
5+025=30
999899=125
9+9+9+89+9=125
Hint
Constraints
For all test cases, it is guaranteed that , , and .
Notes
Translated from COCI2007-2008 Regional Competition T4 JEDNAKOST。
Translated by ChatGPT 5