Cody

Solution 1228128

Submitted on 10 Jul 2017 by Noriko Hounoki
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
x = 'C:\foo\bar\baz\qux'; assert(isequal(shorten(x),'C:\..\qux'))

x2 = 5×1 cell array 'C:' 'foo' 'bar' 'baz' 'qux' x3 = 1×3 cell array 'C:' '\..\' 'qux' x4 = cell 'C: \..\ qux' x5 = cell 'C:\..\qux' y = 'C:\..\qux'

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

x2 = 5×1 cell array 'this' 'is' 'just' 'a' 'test' x3 = 1×3 cell array 'this' '\..\' 'test' x4 = cell 'this \..\ test' x5 = cell 'this\..\test' y = 'this\..\test'

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

x2 = 3×1 cell array 'testing' 'testing' '123.mat' x3 = 1×3 cell array 'testing' '\..\' '123.mat' x4 = cell 'testing \..\ 123.mat' x5 = cell 'testing\..\123.mat' y = 'testing\..\123.mat'