Cody

Problem 78. Implement a ROT13 cipher

Solution 1435779

Submitted on 7 Feb 2018 by Toolman Thoolen
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))

nums = 73 32 108 111 118 101 32 77 65 84 76 65 66 s2 = 'V ybir ZNGYNO'

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

nums = 73 32 60 51 32 77 65 84 76 65 66 33 33 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))

nums = Columns 1 through 29 84 104 101 32 113 117 105 99 107 32 102 111 120 32 115 116 117 109 98 108 101 100 32 111 118 101 114 32 116 Columns 30 through 55 104 101 32 99 111 110 102 117 115 105 110 103 32 105 110 115 116 114 117 99 116 105 111 110 115 46 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))

nums = Columns 1 through 29 83 110 97 112 101 32 107 105 108 108 115 32 68 117 109 98 108 101 100 111 114 101 32 111 110 32 112 97 103 Columns 30 through 58 101 32 54 48 54 46 32 65 108 115 111 44 32 116 104 101 114 101 32 105 115 32 110 111 32 83 97 110 116 Columns 59 through 60 97 46 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!