Cody

# Problem 1383. Count letters occurence in text, specific to words with a given length.

Solution 263990

Submitted on 19 Jun 2013 by Yuan
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
%% txt = 'Hello World, from MATLAB' ; nl = 5 ; counts_correct = [0 0 0 1 1 0 0 1 0 0 0 3 0 0 2 0 0 1 0 0 0 0 1 0 0 0]; assert(isequal(nlWords_getCounts(txt, nl),counts_correct))

``` z = 'hello' 'world' 'from' 'matlab' ans = [] ```

2   Pass
%% txt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.' nl = 9 ; counts_correct = [3 0 3 1 5 0 1 1 0 0 0 1 0 2 1 2 0 2 2 0 2 0 1 0 0 0]; assert(isequal(nlWords_getCounts(txt, nl),counts_correct))

``` txt = UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged. z = Columns 1 through 8 'upper' 'converts' 'any' 'lowercase' 'characters' 'in' 'the' 'string' Columns 9 through 16 'str' 'to' 'the' 'corresponding' 'uppercase' 'characters' 'and' 'leaves' Columns 17 through 21 'all' 'other' 'characters' 'unchanged' '' ans = [] ```

3   Pass
%% txt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.' nl = 10 ; counts_correct = [6 0 6 0 3 0 0 3 0 0 0 0 0 0 0 0 0 6 3 3 0 0 0 0 0 0]; assert(isequal(nlWords_getCounts(txt, nl),counts_correct))

``` txt = UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged. z = Columns 1 through 8 'upper' 'converts' 'any' 'lowercase' 'characters' 'in' 'the' 'string' Columns 9 through 16 'str' 'to' 'the' 'corresponding' 'uppercase' 'characters' 'and' 'leaves' Columns 17 through 21 'all' 'other' 'characters' 'unchanged' '' ans = [] ```