Equals

0

0 votes
Very-Easy
Problem

Given a string consists only of digits(1-9) and two operators "+" and "=". The task is to minimise the string.You can only add the digits that are connected to "+" operator.
No two digits can be consecutive and no two operator can be consecutive.
The start and end of the string is always digits.

Input

The first line will contain the number of test cases T. The first line of each test case will contain a string

Output
For each testcase, print the desired string.
Constraints 1<=T<=10
1<=String Size<=10^5

sample input:
3
2+3+4=6+7+8=4+8+9
2+5=6+7
5+8=7+9

sample output:
9=21=21
7=13
13=16

Problem Setter : Surya Pratap Singh

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?