Cody

Problem 1694. Now 20% off!

Solution 374253

Submitted on 24 Dec 2013 by Mehmet E. Yavuz
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
s='abcde?fgh123ij'; s_correct='abcdX?fgh123iX'; assert(isequal(string_furlough(s),s_correct))

ind = 1 2 3 4 5 7 8 9 13 14

2   Pass
%% s='non-essential personnel' s_correct = 'non-eXsentXal peXsonnXl'; assert(isequal(string_furlough(s),s_correct))

s = non-essential personnel ind = 1 2 3 5 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23

3   Pass
%% s='The furloughs will continue until morale improves.' s_correct = 'The fXrlouXhs wiXl conXinue Xntil XoralX imprXves.'; assert(isequal(string_furlough(s),s_correct))

s = The furloughs will continue until morale improves. ind = 1 2 3 5 6 7 8 9 10 11 12 13 15 16 17 18 20 21 22 23 24 25 26 27 29 30 31 32 33 35 36 37 38 39 40 42 43 44 45 46 47 48 49

4   Pass
%% s='Who doesn''t like a 20% pay cut?' s_correct='Who dXesn''t Xike a 20% Xay cuX?' assert(isequal(string_furlough(s),s_correct))

s = Who doesn't like a 20% pay cut? s_correct = Who dXesn't Xike a 20% Xay cuX? ind = 1 2 3 5 6 7 8 9 11 13 14 15 16 18 24 25 26 28 29 30

5   Pass
%% s='The quick brown fox jumps over the lazy dog.' s_correct = 'The qXick bXown fXx jumXs oveX the lXzy doX.'; assert(isequal(string_furlough(s),s_correct))

s = The quick brown fox jumps over the lazy dog. ind = 1 2 3 5 6 7 8 9 11 12 13 14 15 17 18 19 21 22 23 24 25 27 28 29 30 32 33 34 36 37 38 39 41 42 43

6   Pass
%% s='A-B-C. Easy as 1-2-3.'; s_correct = 'A-B-C. EXsy as 1-2-3.'; assert(isequal(string_furlough(s),s_correct))

ind = 1 3 5 9 10 11 12 14 15

7   Pass
%% s='My single favorite TV show is X-Files!'; s_correct='My siXgle fXvoriXe TV sXow is X-FileX!'; assert(isequal(string_furlough(s),s_correct))

ind = 1 2 4 5 6 7 8 9 11 12 13 14 15 16 17 18 20 21 23 24 25 26 28 29 31 33 34 35 36 37

Suggested Problems

More from this Author80

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!