Cody

Solution 1024589

Submitted on 20 Oct 2016 by Gergely Patay
  • Size: 13
  • This is the leading solution.
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
str = 'series{d-96}x11{second}'; y_correct = {'d-96';'second'}; assert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))

ans = 2×1 cell array 'd-96' 'second'

2   Pass
str = 'x=rho*x{-1}+(1-rho)*y{+1}'; y_correct = {'-1';'+1'}; assert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))

ans = 2×1 cell array '-1' '+1'

3   Pass
str = 'hello there; this string contains no braces'; y_correct = {}; assert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))

ans = 0×0 empty cell array

4   Pass
str = '{one} two three {four} five {six} seven'; y_correct = {'one';'four';'six'}; assert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))

ans = 3×1 cell array 'one' 'four' 'six'

5   Pass
str = '{Where} in the world {is the} thick, red {encyclopedia?}'; y_correct = {'Where';'is the';'encyclopedia?'}; assert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))

ans = 3×1 cell array 'Where' 'is the' 'encyclopedia?'

Suggested Problems

More from this Author10