Cody

Solution 1632650

Submitted on 24 Sep 2018 by Michael Jarboe
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
x = 'C:\foo\bar\baz\qux'; assert(isequal(shorten(x),'C:\..\qux'))

a = 3 7 11 15 z = '\foo\bar\baz\' y = 'C:\..\qux'

2   Pass
x = 'this\is\just\a\test'; assert(isequal(shorten(x),'this\..\test'))

a = 5 8 13 15 z = '\is\just\a\' y = 'this\..\test'

3   Pass
x = 'testing\testing\123.mat'; assert(isequal(shorten(x),'testing\..\123.mat'))

a = 8 16 z = '\testing\' y = 'testing\..\123.mat'

4   Pass
x = 'testing\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10\123.mat'; assert(isequal(shorten(x),'testing\..\123.mat'))

a = 8 11 14 17 20 23 26 29 32 35 39 z = '\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10\' y = 'testing\..\123.mat'

5   Pass
x = 'corp.company_name.com\dir1\dir2\dir3\dir4\file'; assert(isequal(shorten(x),'corp.company_name.com\..\file'))

a = 22 27 32 37 42 z = '\dir1\dir2\dir3\dir4\' y = 'corp.company_name.com\..\file'

6   Pass
x = 'dir1\dir2\dir3\d.txt'; assert(isequal(shorten(x),'dir1\..\d.txt'))

a = 5 10 15 z = '\dir2\dir3\' y = 'dir1\..\d.txt'

7   Pass
x = 'dir1\dir#2\dir_3\dir%4\dir(5)\dir+6\d.txt'; assert(isequal(shorten(x),'dir1\..\d.txt'))

a = 5 11 17 23 30 36 z = '\dir#2\dir_3\dir%4\dir(5)\dir+6\' y = 'dir1\..\d.txt'