Cody

# Problem 78. Implement a ROT13 cipher

Solution 1203445

Submitted on 3 Jun 2017 by Said BOUREZG
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))

k = 1 3 4 5 6 8 9 10 11 12 13 ans = 73 108 111 118 101 77 65 84 76 65 66 d = 73 108 111 118 101 77 65 84 76 65 66 ans = 73 121 111 118 114 77 65 84 76 65 66 ans = 86 121 111 118 114 90 78 84 89 78 79 ans = 86 121 111 118 114 90 78 71 89 78 79 ans = 86 121 98 105 114 90 78 71 89 78 79 s1 = 'V ybir ZNGYNO' ans = 'V ybir ZNGYNO'

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

k = 1 6 7 8 9 10 11 ans = 73 77 65 84 76 65 66 d = 73 77 65 84 76 65 66 ans = 73 77 65 84 76 65 66 ans = 86 90 78 84 89 78 79 ans = 86 90 78 71 89 78 79 ans = 86 90 78 71 89 78 79 s1 = 'V <3 ZNGYNO!!' ans = '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))

k = 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 ans = Columns 1 through 29 84 104 101 113 117 105 99 107 102 111 120 115 116 117 109 98 108 101 100 111 118 101 114 116 104 101 99 111 110 Columns 30 through 47 102 117 115 105 110 103 105 110 115 116 114 117 99 116 105 111 110 115 d = Columns 1 through 29 84 104 101 113 117 105 99 107 102 111 120 115 116 117 109 98 108 101 100 111 118 101 114 116 104 101 99 111 110 Columns 30 through 47 102 117 115 105 110 103 105 110 115 116 114 117 99 116 105 111 110 115 ans = Columns 1 through 29 84 117 114 113 117 118 112 120 115 111 120 115 116 117 122 111 121 114 113 111 118 114 114 116 117 114 112 111 110 Columns 30 through 47 115 117 115 118 110 116 118 110 115 116 114 117 112 116 118 111 110 115 ans = Columns 1 through 29 84 117 114 113 117 118 112 120 115 111 120 115 116 117 122 111 121 114 113 111 118 114 114 116 117 114 112 111 110 Columns 30 through 47 115 117 115 118 110 116 118 110 115 116 114 117 112 116 118 111 110 115 ans = Columns 1 through 29 71 117 114 113 117 118 112 120 115 111 120 115 116 117 122 111 121 114 113 111 118 114 114 116 117 114 112 111 110 Columns 30 through 47 115 117 115 118 110 116 118 110 115 116 114 117 112 116 118 111 110 115 ans = Columns 1 through 29 71 117 114 100 104 118 112 120 115 98 107 102 103 104 122 111 121 114 113 98 105 114 101 103 117 114 112 98 97 Columns 30 through 47 115 104 102 118 97 116 118 97 102 103 101 104 112 103 118 98 97 102 s1 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf.' ans = '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))

k = 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 ans = Columns 1 through 29 83 110 97 112 101 107 105 108 108 115 68 117 109 98 108 101 100 111 114 101 111 110 112 97 103 101 65 108 115 Columns 30 through 44 111 116 104 101 114 101 105 115 110 111 83 97 110 116 97 d = Columns 1 through 29 83 110 97 112 101 107 105 108 108 115 68 117 109 98 108 101 100 111 114 101 111 110 112 97 103 101 65 108 115 Columns 30 through 44 111 116 104 101 114 101 105 115 110 111 83 97 110 116 97 ans = Columns 1 through 29 83 110 110 112 114 120 118 121 121 115 68 117 122 111 121 114 113 111 114 114 111 110 112 110 116 114 65 121 115 Columns 30 through 44 111 116 117 114 114 114 118 115 110 111 83 110 110 116 110 ans = Columns 1 through 29 83 110 110 112 114 120 118 121 121 115 81 117 122 111 121 114 113 111 114 114 111 110 112 110 116 114 78 121 115 Columns 30 through 44 111 116 117 114 114 114 118 115 110 111 83 110 110 116 110 ans = Columns 1 through 29 70 110 110 112 114 120 118 121 121 115 81 117 122 111 121 114 113 111 114 114 111 110 112 110 116 114 78 121 115 Columns 30 through 44 111 116 117 114 114 114 118 115 110 111 70 110 110 116 110 ans = Columns 1 through 29 70 97 110 99 114 120 118 121 121 102 81 104 122 111 121 114 113 98 101 114 98 97 99 110 116 114 78 121 102 Columns 30 through 44 98 103 117 114 101 114 118 102 97 98 70 110 97 103 110 s1 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.' ans = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.'