Back
Close
  • 73

Statement

 Goal

Write a program that outputs all possibilities to put + or - or nothing between the digits of a number N such that the result is K(a number).

For an example N = 123456789 and K = 100

Explanation : 1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100.
(This is just 1 case, you are supposed to find all of them).

NOTE : When there is nothing between the numbers they get appended.
NOTE : The order of the digits should not be changed.
NOTE : Ordering priority is nothing > + > - .
NOTE : There is no 0 involved in N.
Input
line 1: the number N.
line 1: K (Target Number).
Output
Lines containing each expression that equals the target number.
Constraints
1 ≤ N ≤ 10^10
1 ≤ K ≤ 10^8
Example
Input
123
6
Output
1+2+3

A higher resolution is required to access the IDE