Cody

# Problem 78. Implement a ROT13 cipher

Solution 1527388

Submitted on 13 May 2018 by Aryeh Samoka
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))

s3 = 1×13 logical array 1 0 1 0 0 1 0 1 1 0 1 1 1 s4 = 1×13 logical array 0 0 0 1 1 0 0 0 0 1 0 0 0 s2 = 86 32 121 98 105 114 32 90 78 71 89 78 79

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

s3 = 1×13 logical array 1 0 0 0 0 1 1 0 1 1 1 0 0 s4 = 1×13 logical array 0 0 0 0 0 0 0 1 0 0 0 0 0 s2 = 86 32 60 51 32 90 78 71 89 78 79 33 33

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

s3 = 1×55 logical array Columns 1 through 44 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0 1 0 0 0 1 1 0 1 0 0 1 0 0 1 0 1 0 1 0 Columns 45 through 55 0 0 0 0 1 0 1 0 0 0 0 s4 = 1×55 logical array Columns 1 through 44 1 0 0 0 1 1 0 0 0 0 0 1 1 0 1 1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 1 1 0 1 1 0 1 0 0 0 1 Columns 45 through 55 1 1 1 1 0 1 0 1 1 1 0 s2 = Columns 1 through 29 71 117 114 32 100 104 118 112 120 32 115 98 107 32 102 103 104 122 111 121 114 113 32 98 105 114 101 32 103 Columns 30 through 55 117 114 32 112 98 97 115 104 102 118 97 116 32 118 97 102 103 101 104 112 103 118 98 97 102 46

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

s3 = 1×60 logical array Columns 1 through 44 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 1 1 1 1 0 0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 Columns 45 through 60 1 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 s4 = 1×60 logical array Columns 1 through 44 1 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 Columns 45 through 60 0 1 0 0 0 1 0 1 1 0 1 0 1 1 0 0 s2 = Columns 1 through 29 70 97 110 99 114 32 120 118 121 121 102 32 81 104 122 111 121 114 113 98 101 114 32 98 97 32 99 110 116 Columns 30 through 58 114 32 54 48 54 46 32 78 121 102 98 44 32 103 117 114 101 114 32 118 102 32 97 98 32 70 110 97 103 Columns 59 through 60 110 46