Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 283698

Submitted on 17 Jul 2013 by Dan

Correct

11Size
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
Code Input and Output
1
Pass
 
%%
Sentence = 'The birds in the field are eating bird seed';
Not_allowed = 'field'
output = 1;
assert(isequal(NotAllowed(Sentence, Not_allowed),output))
Not_allowed =
field
y =
     1
ans =
     []
2
Pass
 
%%
Sentence = 'If the sky is blue on earth, what is the sky color on mars?';
Not_allowed = 'oven'
output = 0;
assert(isequal(NotAllowed(Sentence, Not_allowed),output))
Not_allowed =
oven
y =
     0
ans =
     []
3
Pass
 
%%
Sentence = 'Oh where, oh where has my little dog gone?';
Not_allowed = 'where'
output = 1;
assert(isequal(NotAllowed(Sentence, Not_allowed),output))
Not_allowed =
where
y =
     1
ans =
     []
4
Pass
 
%%
Sentence = 'Insanity: doing the same thing over and over again and expecting different results...';
Not_allowed = 'Einstein'
output = 0;
assert(isequal(NotAllowed(Sentence, Not_allowed),output))
Not_allowed =
Einstein
y =
     0
ans =
     []
5
Pass
 
%%
Sentence = 'Wheres the cream filling?';
Not_allowed = 'cream'
output = 1;
assert(isequal(NotAllowed(Sentence, Not_allowed),output))
Not_allowed =
cream
y =
     1
ans =
     []
6
Pass
 
%%
Sentence = 'MATLAB is the coolest!';
Not_allowed = 'MATLAB'
output = 1;
assert(isequal(NotAllowed(Sentence, Not_allowed),output))
Not_allowed =
MATLAB
y =
     1
ans =
     []
7
Pass
 
%%
Sentence = 'No no, you got it all wrong!';
Not_allowed = 'No'
output = 1;
assert(isequal(NotAllowed(Sentence, Not_allowed),output))
Not_allowed =
No
y =
     1
ans =
     []
8
Pass
 
%%
Sentence = 'This planet, with all its appalling immensity, is to electric currents virtually no more than a small metal ball.';
Not_allowed = 'Tesla'
output = 0;
assert(isequal(NotAllowed(Sentence, Not_allowed),output))
Not_allowed =
Tesla
y =
     0
ans =
     []