Cody

# Problem 2361. Find the longest match inside two strings

Solution 1777964

Submitted on 8 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   Fail
first = 'minimum'; second = 'maximum'; match = substrmatch( first, second ); assert( strcmp( match, 'imum' ) )

Error using substrmatch Too many input arguments. Error in Test1 (line 3) match = substrmatch( first, second );

2   Fail
first = 'aabbcc'; second = 'abc'; match = substrmatch( first, second ); assert( strcmp( match, 'ab' ) || strcmp( match, 'bc' ) )

Error using substrmatch Too many input arguments. Error in Test2 (line 3) match = substrmatch( first, second );

3   Fail
first = 'MATLAB'; second = 'LAPACK'; match = substrmatch( first, second ); assert( strcmp( match, 'LA' ) )

Error using substrmatch Too many input arguments. Error in Test3 (line 3) match = substrmatch( first, second );

4   Fail
first = 'abc'; second = 'def'; match = substrmatch( first, second ); assert( strcmp( match, '' ) )

Error using substrmatch Too many input arguments. Error in Test4 (line 3) match = substrmatch( first, second );

5   Fail
first = 'banana'; second = 'anagram'; match = substrmatch( first, second ); assert( strcmp( match, 'ana' ) )

Error using substrmatch Too many input arguments. Error in Test5 (line 3) match = substrmatch( first, second );

6   Fail
first = 'string within a string'; second = 'within'; match = substrmatch( first, second ); assert( strcmp( match, 'within' ) )

Error using substrmatch Too many input arguments. Error in Test6 (line 3) match = substrmatch( first, second );

7   Fail
first = 'yes and no'; second = 'ankles and noses'; match = substrmatch( first, second ); assert( strcmp( match, 'es and no' ) )

Error using substrmatch Too many input arguments. Error in Test7 (line 3) match = substrmatch( first, second );

8   Fail
first = 'three apples'; second = 'one apple'; match = substrmatch( first, second ); assert( strcmp( match, 'e apple' ) )

Error using substrmatch Too many input arguments. Error in Test8 (line 3) match = substrmatch( first, second );

9   Fail
first = 'hello there'; second = 'jello that'; match = substrmatch( first, second ); assert( strcmp( match, 'ello th' ) )

Error using substrmatch Too many input arguments. Error in Test9 (line 3) match = substrmatch( first, second );