Cody

# Problem 1694. Now 20% off!

Solution 2845830

Submitted on 17 Aug 2020 by Ramesh Kumar V
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='abcde?fgh123ij'; s_correct='abcdX?fgh123iX'; assert(isequal(string_furlough(s),s_correct))

m = 14 ind = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' c = 0 z = logical 1 c = 1 y = 'a' z = logical 1 c = 2 y = 'ab' z = logical 1 c = 3 y = 'abc' z = logical 1 c = 4 y = 'abcd' z = logical 1 c = 5 y = 'abcde' y = 'abcdX' c = 0 z = logical 0 y = 'abcdX?' z = logical 1 c = 1 y = 'abcdX?f' z = logical 1 c = 2 y = 'abcdX?fg' z = logical 1 c = 3 y = 'abcdX?fgh' z = logical 0 y = 'abcdX?fgh1' z = logical 0 y = 'abcdX?fgh12' z = logical 0 y = 'abcdX?fgh123' z = logical 1 c = 4 y = 'abcdX?fgh123i' z = logical 1 c = 5 y = 'abcdX?fgh123ij' y = 'abcdX?fgh123iX' c = 0

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

s = 'non-essential personnel' m = 23 ind = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' c = 0 z = logical 1 c = 1 y = 'n' z = logical 1 c = 2 y = 'no' z = logical 1 c = 3 y = 'non' z = logical 0 y = 'non-' z = logical 1 c = 4 y = 'non-e' z = logical 1 c = 5 y = 'non-es' y = 'non-eX' c = 0 z = logical 1 c = 1 y = 'non-eXs' z = logical 1 c = 2 y = 'non-eXse' z = logical 1 c = 3 y = 'non-eXsen' z = logical 1 c = 4 y = 'non-eXsent' z = logical 1 c = 5 y = 'non-eXsenti' y = 'non-eXsentX' c = 0 z = logical 1 c = 1 y = 'non-eXsentXa' z = logical 1 c = 2 y = 'non-eXsentXal' z = logical 0 y = 'non-eXsentXal ' z = logical 1 c = 3 y = 'non-eXsentXal p' z = logical 1 c = 4 y = 'non-eXsentXal pe' z = logical 1 c = 5 y = 'non-eXsentXal per' y = 'non-eXsentXal peX' c = 0 z = logical 1 c = 1 y = 'non-eXsentXal peXs' z = logical 1 c = 2 y = 'non-eXsentXal peXso' z = logical 1 c = 3 y = 'non-eXsentXal peXson' z = logical 1 c = 4 y = 'non-eXsentXal peXsonn' z = logical 1 c = 5 y = 'non-eXsentXal peXsonne' y = 'non-eXsentXal peXsonnX' c = 0 z = logical 1 c = 1 y = 'non-eXsentXal peXsonnXl'

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.' m = 50 ind = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' c = 0 z = logical 1 c = 1 y = 'T' z = logical 1 c = 2 y = 'Th' z = logical 1 c = 3 y = 'The' z = logical 0 y = 'The ' z = logical 1 c = 4 y = 'The f' z = logical 1 c = 5 y = 'The fu' y = 'The fX' c = 0 z = logical 1 c = 1 y = 'The fXr' z = logical 1 c = 2 y = 'The fXrl' z = logical 1 c = 3 y = 'The fXrlo' z = logical 1 c = 4 y = 'The fXrlou' z = logical 1 c = 5 y = 'The fXrloug' y = 'The fXrlouX' c = 0 z = logical 1 c = 1 y = 'The fXrlouXh' z = logical 1 c = 2 y = 'The fXrlouXhs' z = logical 0 y = 'The fXrlouXhs ' z = logical 1 c = 3 y = 'The fXrlouXhs w' z = logical 1 c = 4 y = 'The fXrlouXhs wi' z = logical 1 c = 5 y = 'The fXrlouXhs wil' y = 'The fXrlouXhs wiX' c = 0 z = logical 1 c = 1 y = 'The fXrlouXhs wiXl' z = logical 0 y = 'The fXrlouXhs wiXl ' z = logical 1 c = 2 y = 'The fXrlouXhs wiXl c' z = logical 1 c = 3 y = 'The fXrlouXhs wiXl co' z = logical 1 c = 4 y = 'The fXrlouXhs wiXl con' z = logical 1 c = 5 y = 'The fXrlouXhs wiXl cont' y = 'The fXrlouXhs wiXl conX' c = 0 z = logical 1 c = 1 y = 'The fXrlouXhs wiXl conXi' z = logical 1 c = 2 y = 'The fXrlouXhs wiXl conXin' z = logical 1 c = 3 y = 'The fXrlouXhs wiXl conXinu' z = logical 1 c = 4 y = 'The fXrlouXhs wiXl conXinue' z = logical 0 y = 'The fXrlouXhs wiXl conXinue ' z = logical 1 c = 5 y = 'The fXrlouXhs wiXl conXinue u' y = 'The fXrlouXhs wiXl conXinue X' c = 0 z = logical 1 c = 1 y = 'The fXrlouXhs wiXl conXinue Xn' z = logical 1 c = 2 y = 'The fXrlouXhs wiXl conXinue Xnt' z = logical 1 c = 3 y = 'The fXrlouXhs wiXl conXinue Xnti' z = logical 1 c = 4 y = 'The fXrlouXhs wiXl conXinue Xntil' z = logical 0 y = 'The fXrlouXhs wiXl conXinue Xntil ' z = logical 1 c = 5 y = 'The fXrlouXhs wiXl conXinue Xntil m' y = 'The fXrlouXhs wiXl conXinue Xntil X' c = 0 z = logical 1 c = 1 y = 'The fXrlouXhs wiXl conXinue Xntil Xo' z = logical 1 c = 2 y = 'The fXrlouXhs wiXl conXinue Xntil Xor' z = logical 1 c = 3 y = 'The fXrlouXhs wiXl conXinue Xntil Xora' z = logical 1 c = 4 y = 'The fXrlouXhs wiXl conXinue Xntil Xoral' z = logical 1 c = 5 y = 'The fXrlouXhs wiXl conXinue Xntil Xorale' y = 'The fXrlouXhs wiXl conXinue Xntil XoralX' c = 0 z = logical 0 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX ' z = logical 1 c = 1 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX i' z = logical 1 c = 2 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX im' z = logical 1 c = 3 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX imp' z = logical 1 c = 4 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX impr' z = logical 1 c = 5 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX impro' y = 'The fXrlouXhs wiXl conXinue Xntil XoralX imprX' c = 0 z = logical 1 c = 1 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX imprXv' z = logical 1 c = 2 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX imprXve' z = logical 1 c = 3 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX imprXves' z = logical 0 y = 'The fXrlouXhs wiXl conXinue Xntil XoralX imprXves.'

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?' m = 31 ind = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' c = 0 z = logical 1 c = 1 y = 'W' z = logical 1 c = 2 y = 'Wh' z = logical 1 c = 3 y = 'Who' z = logical 0 y = 'Who ' z = logical 1 c = 4 y = 'Who d' z = logical 1 c = 5 y = 'Who do' y = 'Who dX' c = 0 z = logical 1 c = 1 y = 'Who dXe' z = logical 1 c = 2 y = 'Who dXes' z = logical 1 c = 3 y = 'Who dXesn' z = logical 0 y = 'Who dXesn'' z = logical 1 c = 4 y = 'Who dXesn't' z = logical 0 y = 'Who dXesn't ' z = logical 1 c = 5 y = 'Who dXesn't l' y = 'Who dXesn't X' c = 0 z = logical 1 c = 1 y = 'Who dXesn't Xi' z = logical 1 c = 2 y = 'Who dXesn't Xik' z = logical 1 c = 3 y = 'Who dXesn't Xike' z = logical 0 y = 'Who dXesn't Xike ' z = logical 1 c = 4 y = 'Who dXesn't Xike a' z = logical 0 y = 'Who dXesn't Xike a ' z = logical 0 y = 'Who dXesn't Xike a 2' z = logical 0 y = 'Who dXesn't Xike a 20' z = logical 0 y = 'Who dXesn't Xike a 20%' z = logical 0 y = 'Who dXesn't Xike a 20% ' z = logical 1 c = 5 y = 'Who dXesn't Xike a 20% p' y = 'Who dXesn't Xike a 20% X' c = 0 z = logical 1 c = 1 y = 'Who dXesn't Xike a 20% Xa' z = logical 1 c = 2 y = 'Who dXesn't Xike a 20% Xay' z = logical 0 y = 'Who dXesn't Xike a 20% Xay ' z = logical 1 c = 3 y = 'Who dXesn't Xike a 20% Xay c' z = logical 1 c = 4 y = 'Who dXesn't Xike a 20% Xay cu' z = logical 1 c = 5 y = 'Who dXesn't Xike a 20% Xay cut' y = 'Who dXesn't Xike a 20% Xay cuX' c = 0 z = logical 0 y = '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.' m = 44 ind = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' c = 0 z = logical 1 c = 1 y = 'T' z = logical 1 c = 2 y = 'Th' z = logical 1 c = 3 y = 'The' z = logical 0 y = 'The ' z = logical 1 c = 4 y = 'The q' z = logical 1 c = 5 y = 'The qu' y = 'The qX' c = 0 z = logical 1 c = 1 y = 'The qXi' z = logical 1 c = 2 y = 'The qXic' z = logical 1 c = 3 y = 'The qXick' z = logical 0 y = 'The qXick ' z = logical 1 c = 4 y = 'The qXick b' z = logical 1 c = 5 y = 'The qXick br' y = 'The qXick bX' c = 0 z = logical 1 c = 1 y = 'The qXick bXo' z = logical 1 c = 2 y = 'The qXick bXow' z = logical 1 c = 3 y = 'The qXick bXown' z = logical 0 y = 'The qXick bXown ' z = logical 1 c = 4 y = 'The qXick bXown f' z = logical 1 c = 5 y = 'The qXick bXown fo' y = 'The qXick bXown fX' c = 0 z = logical 1 c = 1 y = 'The qXick bXown fXx' z = logical 0 y = 'The qXick bXown fXx ' z = logical 1 c = 2 y = 'The qXick bXown fXx j' z = logical 1 c = 3 y = 'The qXick bXown fXx ju' z = logical 1 c = 4 y = 'The qXick bXown fXx jum' z = logical 1 c = 5 y = 'The qXick bXown fXx jump' y = 'The qXick bXown fXx jumX' c = 0 z = logical 1 c = 1 y = 'The qXick bXown fXx jumXs' z = logical 0 y = 'The qXick bXown fXx jumXs ' z = logical 1 c = 2 y = 'The qXick bXown fXx jumXs o' z = logical 1 c = 3 y = 'The qXick bXown fXx jumXs ov' z = logical 1 c = 4 y = 'The qXick bXown fXx jumXs ove' z = logical 1 c = 5 y = 'The qXick bXown fXx jumXs over' y = 'The qXick bXown fXx jumXs oveX' c = 0 z = logical 0 y = 'The qXick bXown fXx jumXs oveX ' z = logical 1 c = 1 y = 'The qXick bXown fXx jumXs oveX t' z = logical 1 c = 2 y = 'The qXick bXown fXx jumXs oveX th' z = logical 1 c = 3 y = 'The qXick bXown fXx jumXs oveX the' z = logical 0 y = 'The qXick bXown fXx jumXs oveX the ' z = logical 1 c = 4 y = 'The qXick bXown fXx jumXs oveX the l' z = logical 1 c = 5 y = 'The qXick bXown fXx jumXs oveX the la' y = 'The qXick bXown fXx jumXs oveX the lX' c = 0 z = logical 1 c = 1 y = 'The qXick bXown fXx jumXs oveX the lXz' z = logical 1 c = 2 y = 'The qXick bXown fXx jumXs oveX the lXzy' z = logical 0 y = 'The qXick bXown fXx jumXs oveX the lXzy ' z = logical 1 c = 3 y = 'The qXick bXown fXx jumXs oveX the lXzy d' z = logical 1 c = 4 y = 'The qXick bXown fXx jumXs oveX the lXzy do' z = logical 1 c = 5 y = 'The qXick bXown fXx jumXs oveX the lXzy dog' y = 'The qXick bXown fXx jumXs oveX the lXzy doX' c = 0 z = logical 0 y = '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))

m = 22 ind = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' c = 0 z = logical 1 c = 1 y = 'A' z = logical 0 y = 'A-' z = logical 1 c = 2 y = 'A-B' z = logical 0 y = 'A-B-' z = logical 1 c = 3 y = 'A-B-C' z = logical 0 y = 'A-B-C.' z = logical 0 y = 'A-B-C. ' z = logical 0 y = 'A-B-C. ' z = logical 1 c = 4 y = 'A-B-C. E' z = logical 1 c = 5 y = 'A-B-C. Ea' y = 'A-B-C. EX' c = 0 z = logical 1 c = 1 y = 'A-B-C. EXs' z = logical 1 c = 2 y = 'A-B-C. EXsy' z = logical 0 y = 'A-B-C. EXsy ' z = logical 1 c = 3 y = 'A-B-C. EXsy a' z = logical 1 c = 4 y = 'A-B-C. EXsy as' z = logical 0 y = 'A-B-C. EXsy as ' z = logical 0 y = 'A-B-C. EXsy as 1' z = logical 0 y = 'A-B-C. EXsy as 1-' z = logical 0 y = 'A-B-C. EXsy as 1-2' z = logical 0 y = 'A-B-C. EXsy as 1-2-' z = logical 0 y = 'A-B-C. EXsy as 1-2-3' z = logical 0 y = 'A-B-C. EXsy as 1-2-3.'

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))

m = 38 ind = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' c = 0 z = logical 1 c = 1 y = 'M' z = logical 1 c = 2 y = 'My' z = logical 0 y = 'My ' z = logical 1 c = 3 y = 'My s' z = logical 1 c = 4 y = 'My si' z = logical 1 c = 5 y = 'My sin' y = 'My siX' c = 0 z = logical 1 c = 1 y = 'My siXg' z = logical 1 c = 2 y = 'My siXgl' z = logical 1 c = 3 y = 'My siXgle' z = logical 0 y = 'My siXgle ' z = logical 1 c = 4 y = 'My siXgle f' z = logical 1 c = 5 y = 'My siXgle fa' y = 'My siXgle fX' c = 0 z = logical 1 c = 1 y = 'My siXgle fXv' z = logical 1 c = 2 y = 'My siXgle fXvo' z = logical 1 c = 3 y = 'My siXgle fXvor' z = logical 1 c = 4 y = 'My siXgle fXvori' z = logical 1 c = 5 y = 'My siXgle fXvorit' y = 'My siXgle fXvoriX' c = 0 z = logical 1 c = 1 y = 'My siXgle fXvoriXe' z = logical 0 y = 'My siXgle fXvoriXe ' z = logical 1 c = 2 y = 'My siXgle fXvoriXe T' z = logical 1 c = 3 y = 'My siXgle fXvoriXe TV' z = logical 0 y = 'My siXgle fXvoriXe TV ' z = logical 1 c = 4 y = 'My siXgle fXvoriXe TV s' z = logical 1 c = 5 y = 'My siXgle fXvoriXe TV sh' y = 'My siXgle fXvoriXe TV sX' c = 0 z = logical 1 c = 1 y = 'My siXgle fXvoriXe TV sXo' z = logical 1 c = 2 y = 'My siXgle fXvoriXe TV sXow' z = logical 0 y = 'My siXgle fXvoriXe TV sXow ' z = logical 1 c = 3 y = 'My siXgle fXvoriXe TV sXow i' z = logical 1 c = 4 y = 'My siXgle fXvoriXe TV sXow is' z = logical 0 y = 'My siXgle fXvoriXe TV sXow is ' z = logical 1 c = 5 y = 'My siXgle fXvoriXe TV sXow is X' y = 'My siXgle fXvoriXe TV sXow is X' c = 0 z = logical 0 y = 'My siXgle fXvoriXe TV sXow is X-' z = logical 1 c = 1 y = 'My siXgle fXvoriXe TV sXow is X-F' z = logical 1 c = 2 y = 'My siXgle fXvoriXe TV sXow is X-Fi' z = logical 1 c = 3 y = 'My siXgle fXvoriXe TV sXow is X-Fil' z = logical 1 c = 4 y = 'My siXgle fXvoriXe TV sXow is X-File' z = logical 1 c = 5 y = 'My siXgle fXvoriXe TV sXow is X-Files' y = 'My siXgle fXvoriXe TV sXow is X-FileX' c = 0 z = logical 0 y = 'My siXgle fXvoriXe TV sXow is X-FileX!'

### Community Treasure Hunt

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

Start Hunting!