Cody

# Problem 42716. Number of occurrences of letter in a text

Solution 810364

Submitted on 20 Jan 2016 by Zikobrelli
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
%% input_text = 'bla, BLA, bla'; occurrence_correct = [3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; assert(isequal(letters_occurrence(input_text),occurrence_correct))

txt = abcdefghijklmnopqrstuvwxyz y = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 3 3 0 0 0 0 0 0 0 0 0 3 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0

2   Pass
%% input_text = {'King Richard: A horse, a horse! My kingdom for a horse!'}; occurrence_correct = [4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 0 6 3 0 0 0 0 0 1 0]; assert(isequal(letters_occurrence(input_text),occurrence_correct))

txt = abcdefghijklmnopqrstuvwxyz y = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 0 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 3 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 3 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 3 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 3 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 3 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 3 0 0 0 0 0 0 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 3 0 0 0 0 0 1 0 y = Columns 1 through 16 4 0 1 2 3 1 2 4 3 0 2 0 2 2 5 0 Columns 17 through 26 0 6 3 0 0 0 0 0 1 0

3   Pass
%% input_text = {'Thus much let me avow--'; 'You are not wrong, who deem'; 'That my days have been a dream;'}; occurrence_correct = [7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 0 3 2 5 3 2 3 0 3 0]; assert(isequal(letters_occurrence(input_text),occurrence_correct))

txt = abcdefghijklmnopqrstuvwxyz y = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 0 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 2 0 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 2 5 0 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 2 5 3 0 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 2 5 3 2 0 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 2 5 3 2 3 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 2 5 3 2 3 0 0 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 2 5 3 2 3 0 3 0 y = Columns 1 through 16 7 1 1 3 9 0 1 5 0 0 0 1 5 3 5 0 Columns 17 through 26 0 3 2 5 3 2 3 0 3 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!