Cody

# Problem 967. Split a string into chunks of specified length

Solution 2116106

Submitted on 3 Feb 2020 by Hamza Maqbool
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
s = 'Easy'; b = ones(1,4); y_correct = {'E','a','s','y'}; assert(isequal(break_string(s,b),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In break_string (line 1) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)]

2   Pass
s = 'I seem to be having tremendous difficulty with my lifestyle'; b = [4 1 5 22]; y_correct = {'I se','e','m to ','be having tremendous d'}; assert(isequal(break_string(s,b),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In break_string (line 1) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)]

3   Pass
s = 'The answer is 42'; b = [4 7 3]; y_correct = {'The ','answer ','is '}; assert(isequal(break_string(s,b),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In break_string (line 1) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)]

4   Pass
s = 'Did I do that?'; b = [2 3 3]; y_correct = {'Di','d I',' do'}; assert(isequal(break_string(s,b),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In break_string (line 1) In ScoringEngineTestPoint4 (line 4) In solutionTest (line 9)]

5   Pass
s = 'Yes no when?'; b = [2 6 3]; y_correct = {'Ye','s no w','hen'}; assert(isequal(break_string(s,b),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In break_string (line 1) In ScoringEngineTestPoint5 (line 4) In solutionTest (line 11)]

6   Pass
s = 'Hello there'; b = [3 4 4]; y_correct = {'Hel','lo t','here'}; assert(isequal(break_string(s,b),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In break_string (line 1) In ScoringEngineTestPoint6 (line 4) In solutionTest (line 13)]

7   Pass
s = 'One is not enough!'; b = [3 1 1]; y_correct = {'One',' ','i'}; assert(isequal(break_string(s,b),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In break_string (line 1) In ScoringEngineTestPoint7 (line 4) In solutionTest (line 15)]