Cody

Problem 920. Eliminate Polysyllabics: Long live short words!

Solution 1872692

Submitted on 12 Jul 2019 by Michael Cappello
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))

s1 = 1×14 cell array {'The'} {'all'} {'day'} {'meetings'} {'will'} {'continue'} {'until'} {'we'} {'learn'} {'why'} {'productivity'} {'is'} {'so'} {'low'} L = 1×14 logical array 0 0 0 1 0 1 1 0 0 0 1 0 0 0 s1 = 1×10 cell array {'The'} {'all'} {'day'} {'will'} {'we'} {'learn'} {'why'} {'is'} {'so'} {'low'} s1 = 'The all day will we learn why is so low'

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

s1 = 1×8 cell array {'I'} {'am'} {'perpetually'} {'perplexed'} {'my'} {'big'} {'brain'} {'notwithstanding'} L = 1×8 logical array 0 0 1 1 0 0 0 1 s1 = 1×5 cell array {'I'} {'am'} {'my'} {'big'} {'brain'} s1 = 'I am my big brain'

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

s1 = 1×9 cell array {'Lazy'} {'gravy'} {'calico'} {'sky'} {'ipso'} {'facto'} {'sweet'} {'potato'} {'pie'} L = 1×9 logical array 1 1 1 0 1 1 0 1 0 s1 = 1×3 cell array {'sky'} {'sweet'} {'pie'} s1 = 'sky sweet pie'