Cody

Solution 1069927

Submitted on 3 Dec 2016 by Kensuke Fujita
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
f = '2(x + y)'; y = expandf(f); validatestring(y,{'2 ( x + y )'}) assert(isequal(y,'2 ( x + y )'),'Not that kind of expansion ;)')

y = 2 ( x + y ) [2] [ ] [(] [ ] [x] [ ] [ ] [ ] [+] [ ] [ ] [ ] [y] [ ] [)] ans = 2 ( x + y )

2   Pass
f = '2(x + y + z)'; y = expandf(f); validatestring(y,{'2 ( x + y + z )'}) assert(isequal(y,'2 ( x + y + z )'),'Not that kind of expansion ;)')

y = 2 ( x + y + z ) [2] [ ] [(] [ ] [x] [ ] [ ] [ ] [+] [ ] [ ] [ ] [y] [ ] [ ] [ ] [+] [ ] [ ] [ ] [z] [ ] [)] ans = 2 ( x + y + z )