Cody

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

Solution 1800209

Submitted on 29 Apr 2019
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   Fail
[a,g] = your_fcn_name(''); assert(isempty(a)) assert(isempty(g))

s = 1×1 cell array {0×0 char} a = 0 g = 0

Assertion failed.

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

s = 1×2 cell array {0×0 char} {0×0 char} a = 0 g = 0

Assertion failed.

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

s = 1×1 cell array {0×0 char} a = 0 g = 0

Assertion failed.

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

Error using regexprep The 'STRING' input must be either a char row vector, a cell array of char row vectors, or a string array. Error in your_fcn_name (line 2) c = regexprep(c,'\&amp.',''); Error in Test5 (line 1) [a,g] = your_fcn_name([]);

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

s = 1×2 cell array {0×0 char} {0×0 char} a = 0 g = 0

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

s = 1×9 cell array {0×0 char} {'The'} {'quickbrown'} {'fox'} {'jumps'} {'over'} {'the'} {'lazy'} {'dog'} a = 3.8890 g = 0

Assertion failed.

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

s = 1×6 cell array {'another'} {0×0 char} {0×0 char} {'bites'} {'the'} {'dust'} a = 3.1670 g = 0

Assertion failed.

9   Fail
[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))

s = 1×6 cell array {'Isantidisestablishme…'} {'longestnonscientific…'} {'in'} {'the'} {'English'} {'language'} a = 12.8330 g = 8

Assertion failed.

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

s = 1×3 cell array {'I'} {'ate'} {'pudding'} a = 3.6670 g = 3

Assertion failed.

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

s = 1×3 cell array {'I'} {'hate'} {'pudding'} a = 4 g = 3

Assertion failed.