Cody

# Problem 31. Remove all the words that end with "ain"

Solution 2701196

Submitted on 16 Jul 2020 at 11:08
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   Fail
s1 = 'The rain in Spain falls mainly on the plain'; s2 = 'The in falls mainly on the '; assert(strcmp(remAin(s1),s2));

idd = 6 15 26 41 l = 4 k = 4 m = 9 s1 = 'The in Spain falls mainly on the plain' idd = 11 22 37 l = 3 l = 3 k = 8 m = 14 s1 = 'The in falls mainly on the plain' idd = 17 32 l = 2 l = 2 k = 15 m = 22 s1 = 'The in falls on the plain' idd = 26 l = 1 l = 1

Index exceeds the number of array elements (28). Error in remAin (line 11) while(~isequal(s1(m),' ')&&(m~=l)) Error in Test1 (line 3) assert(strcmp(remAin(s1),s2));

2   Fail
s1 = 'The pain from my migraine makes me complain'; s2 = 'The from my migraine makes me '; assert(strcmp(remAin(s1),s2));

idd = 6 22 41 l = 3 k = 4 m = 9 s1 = 'The from my migraine makes me complain' idd = 18 37 l = 2 l = 2 k = 13 m = 22 s1 = 'The from my makes me complain' idd = 29 l = 1 l = 1

Index exceeds the number of array elements (31). Error in remAin (line 11) while(~isequal(s1(m),' ')&&(m~=l)) Error in Test2 (line 3) assert(strcmp(remAin(s1),s2));

3   Fail
s1 = 'I had to explain that "ain" is not a word'; s2 = 'I had to that "" is not a word'; assert(strcmp(remAin(s1),s2));

idd = 14 24 l = 2 k = 9 m = 17 s1 = 'I had to that "ain" is not a word' idd = 17 l = 1 l = 1 k = 15 m = 21 s1 = 'I had to that is not a word' idd = [] l = 0 s2 = 'I had to that is not a word'

Assertion failed.