Cody

# Problem 541. Use of regexp

Solution 2133505

Submitted on 19 Feb 2020
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
x = 'I played piano. John played football. Anita went home. Are you safe?'; y = {'I played piano.' 'Anita went home.' 'Are you safe?'}; assert(isequal(lazy(x),y))

2   Fail
x = 'Are you okay? Who are you? Olga will call you. Sam saw me.'; y = {'Olga will call you.'}; assert(isequal(lazy(x),y))

Index exceeds the number of array elements (2). Error in lazy (line 13) sentences{k} = x(starting(k):ending(k)+1); Error in Test2 (line 3) assert(isequal(lazy(x),y))

3   Pass
x = 'One is more. Than what? No it''s not. But why? Angela said so.'; y = {'One is more.' 'Angela said so.'}; assert(isequal(lazy(x),y))

4   Fail
x = 'One plus two. Is four. No, that''t not right. It''s three.'; y = {'One plus two.' 'It''s three.'}; assert(isequal(lazy(x),y))

Matrix index is out of range for deletion. Error in lazy (line 8) starting( x == 'I') = []; Error in Test4 (line 3) assert(isequal(lazy(x),y))

5   Fail
x = 'I went home. After the game. It was sad. It was lame. It was great!'; y = {'I went home.' 'After the game.' 'It was lame.'}; assert(isequal(lazy(x),y))

Matrix index is out of range for deletion. Error in lazy (line 8) starting( x == 'I') = []; Error in Test5 (line 3) assert(isequal(lazy(x),y))

6   Fail
x = 'One, two, three. Climb the tree. Four, five, six. It''s not here. Eight and nine. That''s fine.'; y = {'One, two, three.' 'It''s not here.' 'Eight and nine.'}; assert(isequal(lazy(x),y))

Index exceeds the number of array elements (3). Error in lazy (line 13) sentences{k} = x(starting(k):ending(k)+1); Error in Test6 (line 3) assert(isequal(lazy(x),y))

7   Fail
x = 'Either one is fine. Why? Because he said so.'; y = {'Either one is fine.'}; assert(isequal(lazy(x),y))

Index exceeds the number of array elements (1). Error in lazy (line 13) sentences{k} = x(starting(k):ending(k)+1); Error in Test7 (line 3) assert(isequal(lazy(x),y))