Cody

# Problem 91. Get the area codes from a list of phone numbers

Solution 372579

Submitted on 19 Dec 2013
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
%% s = '508-647-7000, (508) 647-7001, 617-555-1212, 1-800-323-1234, 704 555-1212'; a = {'508','617','704','800'}; assert(isequal(refcn(s),a))

s = 508-647-7000, (508) 647-7001, 617-555-1212, 800-323-1234, 704 555-1212 s = 508-647-7000, (508) 647-7001, 617-555-1212, 800-323-1234, 704 555-1212 s = Columns 1 through 16 5 0 8 6 4 7 7 0 0 0 5 0 8 6 4 7 Columns 17 through 32 7 0 0 1 6 1 7 5 5 5 1 2 1 2 8 0 Columns 33 through 48 0 3 2 3 1 2 3 4 7 0 4 5 5 5 1 2 Columns 49 through 50 1 2 s = Columns 1 through 16 5 0 8 6 4 7 7 0 0 0 5 0 8 6 4 7 Columns 17 through 32 7 0 0 1 6 1 7 5 5 5 1 2 1 2 8 0 Columns 33 through 48 0 3 2 3 1 2 3 4 7 0 4 5 5 5 1 2 Columns 49 through 50 1 2 a = {} a = '508' '617' '704' '800'

2   Fail
%% s = '212-657-0260; (888) 647-7001; 336 565-1212; +1-800-323-1234'; a = {'212','336','800','888'}; assert(isequal(refcn(s),a))

Error: Assertion failed.