Cody

Problem 78. Implement a ROT13 cipher

Solution 2168062

Submitted on 21 Mar 2020 by Mehmed Saad
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))

re = 1 3 4 5 6 8 9 10 11 12 13

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

re = 1 6 7 8 9 10 11

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

re = Columns 1 through 29 1 2 3 5 6 7 8 9 11 12 13 15 16 17 18 19 20 21 22 24 25 26 27 29 30 31 33 34 35 Columns 30 through 47 36 37 38 39 40 41 43 44 45 46 47 48 49 50 51 52 53 54

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

re = Columns 1 through 29 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 18 19 20 21 22 24 25 27 28 29 30 37 38 39 Columns 30 through 44 40 43 44 45 46 47 49 50 52 53 55 56 57 58 59

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!