Cody

# Problem 44853. Mean number of letters per word (Hard)

Solution 1733580

Submitted on 22 Feb 2019 by HH
• Size: 66
• This is the leading solution.
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
filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext,'eval'))) assert(isempty(strfind(filetext,'echo'))) assert(isempty(strfind(filetext,'switch')))

2   Pass
[a,g] = your_fcn_name(''); assert(isempty(a)) assert(isempty(g))

3   Pass
[a,g] = your_fcn_name(' '); assert(isempty(a)) assert(isempty(g))

4   Pass
[a,g] = your_fcn_name(' ,& '); assert(isempty(a)) assert(isempty(g))

5   Pass
[a,g] = your_fcn_name([]); assert(isempty(a)) assert(isempty(g))

6   Pass
[a,g] = your_fcn_name('23'); assert(isequal(a,0.000)) assert(isequal(g,0.000))

ans = 0

7   Pass
[a,g] = your_fcn_name(' The quick, brown fox jumps over the lazy dog.'); assert(isequal(a,3.889)) assert(isequal(g,3.792))

ans = 3 5 5 3 5 4 3 4 3

8   Pass
[a,g] = your_fcn_name('...another 1 bites the dust...'); assert(isequal(a,3.800)) assert(isequal(g,0.000))

ans = 7 0 5 3 4

9   Pass
[a,g] = your_fcn_name('Is ''antidisestablishmentarianism'' the longest (nonscientific) word in the English language ?'); assert(isequal(a,7.700)) assert(isequal(g,5.386))

ans = 2 28 3 7 13 4 2 3 7 8

10   Pass
[a,g] = your_fcn_name('I ate pudding :-)'); assert(isequal(a,3.667)) assert(isequal(g,2.759))

ans = 1 3 7

11   Pass
[a,g] = your_fcn_name('I hate pudding!'); assert(isequal(a,4.000)) assert(isequal(g,3.037))

ans = 1 4 7