#P6509. [COCI2007-2008] JEDNAKOST

    ID: 7301 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>动态规划 DP2007Special JudgeO2优化COCI(克罗地亚)

[COCI2007-2008] JEDNAKOST

Problem Description

You are given a string of the form A=B, where both AA and BB are positive integers with no leading zeros. Insert plus signs between some adjacent digits of AA. The goal is to use as few plus signs as possible so that the equation becomes true.

After inserting plus signs into AA, each addend is allowed to have multiple leading zeros, including 00. That is, numbers of the form 000000 \ldots 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 1A<1010001 \leq A \lt 10^{1000}, 1B5×1031 \leq B \leq 5 \times 10^3, and ABA \neq B.

Notes

Translated from COCI2007-2008 Regional Competition T4 JEDNAKOST

Translated by ChatGPT 5