题库练习 [COCI-2007_2008-regional]#1 JEDNAKOST
← 上一题 下一题 →

A1140 | [COCI-2007_2008-regional]#1 JEDNAKOST

来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0

题目描述

While browsing a math book, Mirko found a strange equation of the form A=S. What makes the equation strange is that A and S are not the same. Mirko realized that the left side of the equation should have addition operations between some pairs of digits in A.
Write a program that inserts the smallest number of addition operations on the left side to make the equation correct. The numbers in the corrected equation may contain arbitrary amounts of leading zeros.

输入格式

The first line contains the equation in the form A=S.
A and S will both be positive integers without leading zeros. They will be different.
A will contain at most 1000 digits.
S will be less than or equal to 500
0.
Note: The input data will guarantee that a solution, although not necessarily unique, will always exist.

输出格式

Output the corrected equation. If there are multiple solutions, output any of them.

输入输出样例

输入 #1
143175=120
输出 #1
14+31+75=120 
输入 #2
5025=30
输出 #2
025=30 
输入 #3
999899=125
输出 #3
+9+89+9=125
C++ 编辑器
输入
输出