Cody

# Problem 362. Find matching string from a list of strings

Solution 1877325

Submitted on 17 Jul 2019 by Allen
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
inStr = 'ball'; strList = {'ball', 'bell', 'barn'}; assert(isequal(findMatch(inStr, strList), 'ball'));

2   Pass
inStr = 'auG'; strList = {'May', 'June', 'July', 'August', 'September'}; assert(isequal(findMatch(inStr, strList), 'August'));

s = 1×1 cell array {'August'}

3   Pass
inStr = 'Ju'; strList = {'May', 'June', 'July', 'August', 'September'}; assert(isequal(findMatch(inStr, strList), ''));

s = 1×2 cell array {'June'} {'July'}

4   Pass
inStr = 'fontn'; strList = {'FontName', 'FontUnits', 'FontSize', 'FontWeight'}; assert(isequal(findMatch(inStr, strList), 'FontName'));

s = 1×1 cell array {'FontName'}

5   Pass
inStr = 'weight'; strList = {'FontName', 'FontUnits', 'FontSize', 'FontWeight'}; assert(isequal(findMatch(inStr, strList), 'FontWeight'));

s = 1×1 cell array {'FontWeight'}

6   Pass
inStr = 'ball'; strList = {'baseball', 'balloon', 'ball'}; assert(isequal(findMatch(inStr, strList), 'ball'));

7   Pass
inStr = 'bal'; strList = {'baseball', 'balloon', 'ball'}; assert(isequal(findMatch(inStr, strList), ''));

s = 1×3 cell array {'baseball'} {'balloon'} {'ball'}