Cody

Solution 2254739

Submitted on 4 May 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
s1 = 'The all day meetings will continue until we learn why productivity is so low'; s2_correct = 'The all day will we learn why is so low'; assert(isequal(just_short_words(s1),s2_correct))

A = 1×43 uint16 row vector Columns 1 through 30 84 104 101 32 97 108 108 32 100 97 121 0 32 119 105 108 108 32 32 32 119 101 32 108 101 97 114 110 32 119 Columns 31 through 43 104 121 32 32 105 115 32 115 111 32 108 111 119 A = 1×43 uint16 row vector Columns 1 through 30 84 104 101 32 97 108 108 32 100 97 121 0 32 119 105 108 108 0 32 32 119 101 32 108 101 97 114 110 32 119 Columns 31 through 43 104 121 32 32 105 115 32 115 111 32 108 111 119 A = 1×43 uint16 row vector Columns 1 through 30 84 104 101 32 97 108 108 32 100 97 121 0 32 119 105 108 108 0 0 32 119 101 32 108 101 97 114 110 32 119 Columns 31 through 43 104 121 32 32 105 115 32 115 111 32 108 111 119 A = 1×43 uint16 row vector Columns 1 through 30 84 104 101 32 97 108 108 32 100 97 121 0 32 119 105 108 108 0 0 32 119 101 32 108 101 97 114 110 32 119 Columns 31 through 43 104 121 0 32 105 115 32 115 111 32 108 111 119 s2 = 'The all day will we learn why is so low'

2   Fail
s1 = 'I am perpetually perplexed my big brain notwithstanding'; s2_correct = 'I am my big brain'; assert(isequal(just_short_words(s1),s2_correct))

A = 1×20 uint16 row vector 73 32 97 109 0 32 32 109 121 32 98 105 103 32 98 114 97 105 110 32 A = 1×20 uint16 row vector 73 32 97 109 0 0 32 109 121 32 98 105 103 32 98 114 97 105 110 32

Index exceeds the number of array elements (20). Error in just_short_words (line 20) if A(k+1)==32 Error in Test2 (line 3) assert(isequal(just_short_words(s1),s2_correct))

3   Fail
s1 = 'Lazy gravy calico sky ipso facto sweet potato pie'; s2_correct = 'sky sweet pie'; assert(isequal(just_short_words(s1),s2_correct))

A = 1×19 uint16 row vector 0 32 32 115 107 121 32 32 32 115 119 101 101 116 32 32 112 105 101 A = 1×19 uint16 row vector 0 0 32 115 107 121 32 32 32 115 119 101 101 116 32 32 112 105 101 A = 1×19 uint16 row vector 0 0 32 115 107 121 0 32 32 115 119 101 101 116 32 32 112 105 101 A = 1×19 uint16 row vector 0 0 32 115 107 121 0 0 32 115 119 101 101 116 32 32 112 105 101 A = 1×19 uint16 row vector 0 0 32 115 107 121 0 0 32 115 119 101 101 116 0 32 112 105 101 s2 = ' sky sweet pie'

Assertion failed.