4 of 6 added 8 characters in body

Pyth, 27 26 bytes

.vs+_XUtQUQ"+-*c^":jdQ\-\_


Test suite.

Pyth uses prefix notation: 1+2 is written as +1 2 (space needed to separate numbers).

Therefore, for the first testcase, the expression would be (((1+2)-3)*4)/5, which in prefix notation, would be written as /*-+ 1 2 3 4 5.

In Pyth, float division is c instead of /, so it becomes c*-+ 1 2 3 4 5.

Also, in Pyth, -100 is written as _100 instead.

Therefore, for the third test case, which is ((((((((-8+50)-3)*3)/-123)^4)+17)-99)*13), it becomes: *-+^c*-+ _8 50 3 3 _123 4 17 99 13.

.vs+_XUtQUQ"+-*c^":jdQ\-\_
jdQ       Join input by space.
:   \-\_   Replace "-" with "_".
XUtQUQ"+-*c^"           Generate the string "+-*c^..." of suitable length.
_                        Reverse it.
s+                         Convert the whole thing into a string
.v                           Evaluate as a Pyth expression.


History

• 27 bytes: .vs+_XUtQUQ"+-*c^"m:+;d\-\_
 answered Jun 13 '16 at 7:09 Leaky Nun 45k44 gold badges9090 silver badges262262 bronze badges