Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 274137

Submitted on 5 Jul 2013 by andrea84

Correct

53Size
Leading solution size is 10.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
s='abcde?fgh123ij';
s_correct='abcdX?fgh123iX';
assert(isequal(string_furlough(s),s_correct))
c =
     0
c =
     1
c =
     2
c =
     3
c =
     4
c =
     5
s =
abcdX?fgh123ij
c =
     6
c =
     7
c =
     8
c =
     9
c =
    10
s =
abcdX?fgh123iX
2
Pass
 
%%
s='non-essential personnel'
s_correct = 'non-eXsentXal peXsonnXl';
assert(isequal(string_furlough(s),s_correct))
s =
non-essential personnel
c =
     0
c =
     1
c =
     2
c =
     3
c =
     4
c =
     5
s =
non-eXsential personnel
c =
     6
c =
     7
c =
     8
c =
     9
c =
    10
s =
non-eXsentXal personnel
c =
    11
c =
    12
c =
    13
c =
    14
c =
    15
s =
non-eXsentXal peXsonnel
c =
    16
c =
    17
c =
    18
c =
    19
c =
    20
s =
non-eXsentXal peXsonnXl
c =
    21
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.
c =
     0
c =
     1
c =
     2
c =
     3
c =
     4
c =
     5
s =
The fXrloughs will continue until morale improves.
c =
     6
c =
     7
c =
     8
c =
     9
c =
    10
s =
The fXrlouXhs will continue until morale improves.
c =
    11
c =
    12
c =
    13
c =
    14
c =
    15
s =
The fXrlouXhs wiXl continue until morale improves.
c =
    16
c =
    17
c =
    18
c =
    19
c =
    20
s =
The fXrlouXhs wiXl conXinue until morale improves.
c =
    21
c =
    22
c =
    23
c =
    24
c =
    25
s =
The fXrlouXhs wiXl conXinue Xntil morale improves.
c =
    26
c =
    27
c =
    28
c =
    29
c =
    30
s =
The fXrlouXhs wiXl conXinue Xntil Xorale improves.
c =
    31
c =
    32
c =
    33
c =
    34
c =
    35
s =
The fXrlouXhs wiXl conXinue Xntil XoralX improves.
c =
    36
c =
    37
c =
    38
c =
    39
c =
    40
s =
The fXrlouXhs wiXl conXinue Xntil XoralX imprXves.
c =
    41
c =
    42
c =
    43
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?
c =
     0
c =
     1
c =
     2
c =
     3
c =
     4
c =
     5
s =
Who dXesn't like a 20% pay cut?
c =
     6
c =
     7
c =
     8
c =
     9
c =
    10
s =
Who dXesn't Xike a 20% pay cut?
c =
    11
c =
    12
c =
    13
c =
    14
c =
    15
s =
Who dXesn't Xike a 20% Xay cut?
c =
    16
c =
    17
c =
    18
c =
    19
c =
    20
s =
Who dXesn't Xike a 20% Xay cuX?
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.
c =
     0
c =
     1
c =
     2
c =
     3
c =
     4
c =
     5
s =
The qXick brown fox jumps over the lazy dog.
c =
     6
c =
     7
c =
     8
c =
     9
c =
    10
s =
The qXick bXown fox jumps over the lazy dog.
c =
    11
c =
    12
c =
    13
c =
    14
c =
    15
s =
The qXick bXown fXx jumps over the lazy dog.
c =
    16
c =
    17
c =
    18
c =
    19
c =
    20
s =
The qXick bXown fXx jumXs over the lazy dog.
c =
    21
c =
    22
c =
    23
c =
    24
c =
    25
s =
The qXick bXown fXx jumXs oveX the lazy dog.
c =
    26
c =
    27
c =
    28
c =
    29
c =
    30
s =
The qXick bXown fXx jumXs oveX the lXzy dog.
c =
    31
c =
    32
c =
    33
c =
    34
c =
    35
s =
The qXick bXown fXx jumXs oveX the lXzy doX.
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))
c =
     0
c =
     1
c =
     2
c =
     3
c =
     4
c =
     5
s =
A-B-C.  EXsy as 1-2-3.
c =
     6
c =
     7
c =
     8
c =
     9
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))
c =
     0
c =
     1
c =
     2
c =
     3
c =
     4
c =
     5
s =
My siXgle favorite TV show is X-Files!
c =
     6
c =
     7
c =
     8
c =
     9
c =
    10
s =
My siXgle fXvorite TV show is X-Files!
c =
    11
c =
    12
c =
    13
c =
    14
c =
    15
s =
My siXgle fXvoriXe TV show is X-Files!
c =
    16
c =
    17
c =
    18
c =
    19
c =
    20
s =
My siXgle fXvoriXe TV sXow is X-Files!
c =
    21
c =
    22
c =
    23
c =
    24
c =
    25
s =
My siXgle fXvoriXe TV sXow is X-Files!
c =
    26
c =
    27
c =
    28
c =
    29
c =
    30
s =
My siXgle fXvoriXe TV sXow is X-FileX!