Cody

Problem 2512. longest common semi-substring

Solution 1624853

Submitted on 10 Sep 2018 by cokakola
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
a = 'cat'; b = 'cat' y_correct = 3; assert(isequal(str(a,b),y_correct))

b = 'cat' f = 1 2 3 l = 3 f = 1 2 3 l = 3 f = 1 2 3 l = 3

2   Pass
a = 'cat'; b = 'cut' y_correct = 3; assert(isequal(str(a,b),y_correct))

b = 'cut' f = 1 3 l = 3 f = 1 3 l = 3 f = 1 3 l = 3

3   Pass
a = 'president'; b = 'precedent' y_correct = 9; assert(isequal(str(a,b),y_correct))

b = 'precedent' f = 1 2 3 6 7 8 9 l = 9 f = 1 2 3 6 7 8 9 l = 9 f = 5 l = 1 f = 3 l = 1 f = 1 2 3 6 7 8 9 l = 9 f = 3 l = 1 f = 3 l = 1

4   Pass
a = 'katy perry'; b = 'qqa^%^%rrrrRR' y_correct = 8; assert(isequal(str(a,b),y_correct))

b = 'qqa^%^%rrrrRR' f = 8 9 l = 2 f = 2 8 9 l = 8 f = 8 9 l = 2 f = 8 l = 1 f = 8 l = 1 f = 8 9 l = 2 f = 8 l = 1

5   Pass
a = 'cody was down for a while'; b = '12w123456789o88888888899' y_correct = 11; assert(isequal(str(a,b),y_correct))

b = '12w123456789o88888888899' f = 3 13 l = 11 f = 3 l = 1 f = 3 l = 1 f = 11 l = 1 f = 2 l = 1

6   Pass
a = 'cat'; b = 'dog and other pets' y_correct = 1; assert(isequal(str(a,b),y_correct))

b = 'dog and other pets' f = 2 l = 1 f = 3 l = 1 f = 3 l = 1

7   Pass
a = 'cat'; b = 'aca' y_correct = 2; assert(isequal(str(a,b),y_correct))

b = 'aca' f = 1 l = 1 f = 1 2 l = 2

8   Pass
a = 'apparently nothing in common'; b = 'zzzz zz zzzz' y_correct = 4; assert(isequal(str(a,b),y_correct))

b = 'zzzz zz zzzz' f = 8 l = 1 f = 5 l = 1 f = 8 l = 1 f = 5 8 l = 4 f = 5 l = 1

9   Pass
a = 'nothing in common'; b = 'zzzz' y_correct = 0; assert(isequal(str(a,b),y_correct))

b = 'zzzz'

10   Pass
a = 'empty string testing'; b = ''; y_correct = 0; assert(isequal(str(a,b),y_correct))

11   Pass
a = ''; b = ''; y_correct = 0; assert(isequal(str(a,b),y_correct))