Cody

Problem 78. Implement a ROT13 cipher

Solution 1238743

Submitted on 25 Jul 2017 by Salvatore Lacava
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
s1 = 'I love MATLAB'; s2_correct = 'V ybir ZNGYNO'; assert(isequal(rot13(s1),s2_correct))

ab = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZaAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' s2 = 'I love MATLAB' idx = 18 70 s2 = 'V love MATLAB' idx = 23 75 s2 = 'V yove MATLAB' idx = 29 81 s2 = 'V ybve MATLAB' idx = 43 95 s2 = 'V ybie MATLAB' idx = 9 61 s2 = 'V ybir MATLAB' idx = 26 78 s2 = 'V ybir ZATLAB' idx = 2 54 s2 = 'V ybir ZNTLAB' idx = 40 92 s2 = 'V ybir ZNGLAB' idx = 24 76 s2 = 'V ybir ZNGYAB' idx = 2 54 s2 = 'V ybir ZNGYNB' idx = 4 56 s2 = 'V ybir ZNGYNO'

2   Pass
s1 = 'I <3 MATLAB!!'; s2_correct = 'V <3 ZNGYNO!!'; assert(isequal(rot13(s1),s2_correct))

ab = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZaAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' s2 = 'I <3 MATLAB!!' idx = 18 70 s2 = 'V <3 MATLAB!!' idx = 26 78 s2 = 'V <3 ZATLAB!!' idx = 2 54 s2 = 'V <3 ZNTLAB!!' idx = 40 92 s2 = 'V <3 ZNGLAB!!' idx = 24 76 s2 = 'V <3 ZNGYAB!!' idx = 2 54 s2 = 'V <3 ZNGYNB!!' idx = 4 56 s2 = 'V <3 ZNGYNO!!'

3   Pass
s1 = 'The quick fox stumbled over the confusing instructions.'; s2_correct = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf.'; assert(isequal(rot13(s1),s2_correct))

ab = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZaAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' s2 = 'The quick fox stumbled over the confusing instructions.' idx = 40 92 s2 = 'Ghe quick fox stumbled over the confusing instructions.' idx = 15 67 s2 = 'Gue quick fox stumbled over the confusing instructions.' idx = 9 61 s2 = 'Gur quick fox stumbled over the confusing instructions.' idx = 33 85 s2 = 'Gur duick fox stumbled over the confusing instructions.' idx = 41 93 s2 = 'Gur dhick fox stumbled over the confusing instructions.' idx = 17 69 s2 = 'Gur dhvck fox stumbled over the confusing instructions.' idx = 5 57 s2 = 'Gur dhvpk fox stumbled over the confusing instructions.' idx = 21 73 s2 = 'Gur dhvpx fox stumbled over the confusing instructions.' idx = 11 63 s2 = 'Gur dhvpx sox stumbled over the confusing instructions.' idx = 29 81 s2 = 'Gur dhvpx sbx stumbled over the confusing instructions.' idx = 47 99 s2 = 'Gur dhvpx sbk stumbled over the confusing instructions.' idx = 37 89 s2 = 'Gur dhvpx sbk ftumbled over the confusing instructions.' idx = 39 91 s2 = 'Gur dhvpx sbk fgumbled over the confusing instructions.' idx = 41 93 s2 = 'Gur dhvpx sbk fghmbled over the confusing instructions.' idx = 25 77 s2 = 'Gur dhvpx sbk fghzbled over the confusing instructions.' idx = 3 55 s2 = 'Gur dhvpx sbk fghzoled over the confusing instructions.' idx = 23 75 s2 = 'Gur dhvpx sbk fghzoyed over the confusing instructions.' idx = 9 61 s2 = 'Gur dhvpx sbk fghzoyrd over the confusing instructions.' idx = 7 59 s2 = 'Gur dhvpx sbk fghzoyrq over the confusing instructions.' idx = 29 81 s2 = 'Gur dhvpx sbk fghzoyrq bver the confusing instructions.' idx = 43 95 s2 = 'Gur dhvpx sbk fghzoyrq bier the confusing instructions.' idx = 9 61 s2 = 'Gur dhvpx sbk fghzoyrq birr the confusing instructions.' idx = 35 87 s2 = 'Gur dhvpx sbk fghzoyrq bire the confusing instructions.' idx = 39 91 s2 = 'Gur dhvpx sbk fghzoyrq bire ghe confusing instructions.' idx = 15 67 s2 = 'Gur dhvpx sbk fghzoyrq bire gue confusing instructions.' idx = 9 61 s2 = 'Gur dhvpx sbk fghzoyrq bire gur confusing instructions.' idx = 5 57 s2 = 'Gur dhvpx sbk fghzoyrq bire gur ponfusing instructions.' idx = 29 81 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbnfusing instructions.' idx = 27 79 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbafusing instructions.' idx = 11 63 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbasusing instructions.' idx = 41 93 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashsing instructions.' idx = 37 89 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfing instructions.' idx = 17 69 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvng instructions.' idx = 27 79 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvag instructions.' idx = 13 65 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat instructions.' idx = 17 69 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vnstructions.' idx = 27 79 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vastructions.' idx = 37 89 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vaftructions.' idx = 39 91 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgructions.' idx = 35 87 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgeuctions.' idx = 41 93 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehctions.' idx = 5 57 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehptions.' idx = 39 91 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgions.' idx = 17 69 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvons.' idx = 29 81 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbns.' idx = 27 79 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbas.' idx = 37 89 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf.'

4   Pass
s1 = 'Snape kills Dumbledore on page 606. Also, there is no Santa.'; s2_correct = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.'; assert(isequal(rot13(s1),s2_correct))

ab = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZaAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' s2 = 'Snape kills Dumbledore on page 606. Also, there is no Santa.' idx = 38 90 s2 = 'Fnape kills Dumbledore on page 606. Also, there is no Santa.' idx = 27 79 s2 = 'Faape kills Dumbledore on page 606. Also, there is no Santa.' idx = 1 53 s2 = 'Fanpe kills Dumbledore on page 606. Also, there is no Santa.' idx = 31 83 s2 = 'Fance kills Dumbledore on page 606. Also, there is no Santa.' idx = 9 61 s2 = 'Fancr kills Dumbledore on page 606. Also, there is no Santa.' idx = 21 73 s2 = 'Fancr xills Dumbledore on page 606. Also, there is no Santa.' idx = 17 69 s2 = 'Fancr xvlls Dumbledore on page 606. Also, there is no Santa.' idx = 23 75 s2 = 'Fancr xvyls Dumbledore on page 606. Also, there is no Santa.' idx = 23 75 s2 = 'Fancr xvyys Dumbledore on page 606. Also, there is no Santa.' idx = 37 89 s2 = 'Fancr xvyyf Dumbledore on page 606. Also, there is no Santa.' idx = 8 60 s2 = 'Fancr xvyyf Qumbledore on page 606. Also, there is no Santa.' idx = 41 93 s2 = 'Fancr xvyyf Qhmbledore on page 606. Also, there is no Santa.' idx = 25 77 s2 = 'Fancr xvyyf Qhzbledore on page 606. Also, there is no Santa.' idx = 3 55 s2 = 'Fancr xvyyf Qhzoledore on page 606. Also, there is no Santa.' idx = 23 75 s2 = 'Fancr xvyyf Qhzoyedore on page 606. Also, there is no Santa.' idx = 9 61 s2 = 'Fancr xvyyf Qhzoyrdore on page 606. Also, there is no Santa.' idx = 7 59 s2 = 'Fancr xvyyf Qhzoyrqore on page 606. Also, there is no Santa.' idx = 29 81 s2 = 'Fancr xvyyf Qhzoyrqbre on page 606. Also, there is no Santa.' idx = 35 87 s2 = 'Fancr xvyyf Qhzoyrqbee on page 606. Also, there is no Santa.' idx = 9 61 s2 = 'Fancr xvyyf Qhzoyrqber on page 606. Also, there is no Santa.' idx = 29 81 s2 = 'Fancr xvyyf Qhzoyrqber bn page 606. Also, there is no Santa.' idx = 27 79 s2 = 'Fancr xvyyf Qhzoyrqber ba page 606. Also, there is no Santa.' idx = 31 83 s2 = 'Fancr xvyyf Qhzoyrqber ba cage 606. Also, there is no Santa.' idx = 1 53 s2 = 'Fancr xvyyf Qhzoyrqber ba cnge 606. Also, there is no Santa.' idx = 13 65 s2 = 'Fancr xvyyf Qhzoyrqber ba cnte 606. Also, there is no Santa.' idx = 9 61 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Also, there is no Santa.' idx = 2 54 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nlso, there is no Santa.' idx = 23 75 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyso, there is no Santa.' idx = 37 89 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfo, there is no Santa.' idx = 29 81 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, there is no Santa.' idx = 39 91 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, ghere is no Santa.' idx = 15 67 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, guere is no Santa.' idx = 9 61 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurre is no Santa.' idx = 35 87 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, guree is no Santa.' idx = 9 61 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer is no Santa.' idx = 17 69 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vs no Santa.' idx = 37 89 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf no Santa.' idx = 27 79 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ao Santa.' idx = 29 81 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Santa.' idx = 38 90 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fanta.' idx = 1 53 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnnta.' idx = 27 79 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnata.' idx = 39 91 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnaga.' idx = 1 53 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.'

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!