Cody

# Problem 831. Find mistyped words in text (mixed-up letters)

Solution 2163220

Submitted on 17 Mar 2020 by Michael Jarboe
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
str = 'Can you tell if there is anything wrong with this string?'; correct_words = ''; mistyped_words = {}; assert(isequal(mistype(str,correct_words),mistyped_words))

2   Pass
str = 'I lvoe MATLAB'; correct_words = '*love'; mistyped_words = {'lvoe'}; assert(isequal(mistype(str,correct_words),mistyped_words))

correct words: '*LOVE' [54] str2: 'I' [ 9] 'LVOE' [54] 'MATLAB' [49] 54 9 54 mistyped_words = 1×1 cell array {'lvoe'} 49

3   Pass
str = 'Recieve and beleive are tow commonly misspelled words'; correct_words = '*Receive *believe *two'; mistyped_words = {'Recieve','beleive','tow'}; assert(isequal(mistype(str,correct_words),mistyped_words))

correct words: '*RECEIVE' [67] '*BELIEVE' [60] '*TWO' [58] str2: 'RECIEVE' [ 67] 'AND' [ 19] 'BELEIVE' [ 60] 'ARE' [ 24] 'TOW' [ 58] 'COMMONLY' [110] 'MISSPELLED' [114] 'WORDS' [ 79] 67 67 mistyped_words = 1×1 cell array {'Recieve'} 19 60 24 58 110 114 79 60 67 19 60 mistyped_words = 1×2 cell array {'Recieve'} {'beleive'} 24 58 110 114 79 58 67 19 60 24 58 mistyped_words = 1×3 cell array {'Recieve'} {'beleive'} {'tow'} 110 114 79

4   Pass
str = 'Ihppopatomus si a hard word to psell'; correct_words = '*Hippopotamus *is *spell'; mistyped_words = {'Ihppopatomus','si','psell'}; assert(isequal(mistype(str,correct_words),mistyped_words))

correct words: '*HIPPOPOTAMUS' [169] '*IS' [ 28] '*SPELL' [ 64] str2: 'IHPPOPATOMUS' [169] 'SI' [ 28] 'A' [ 1] 'HARD' [ 31] 'WORD' [ 60] 'TO' [ 35] 'PSELL' [ 64] 169 169 mistyped_words = 1×1 cell array {'Ihppopatomus'} 28 1 31 60 35 64 28 169 28 mistyped_words = 1×2 cell array {'Ihppopatomus'} {'si'} 1 31 60 35 64 64 169 28 1 31 60 35 64 mistyped_words = 1×3 cell array {'Ihppopatomus'} {'si'} {'psell'}