Cody

# Problem 78. Implement a ROT13 cipher

Solution 1474490

Submitted on 29 Mar 2018 by Yanni Wang
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))

a = 73 32 108 111 118 101 32 77 65 84 76 65 66 b = 86 32 b = 86 32 121 98 105 114 32 s2 = 'V ybir ZNGYNO'

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

a = 73 32 60 51 32 77 65 84 76 65 66 33 33 b = 86 32 b = 86 32 60 b = 86 32 60 51 b = 86 32 60 51 32 b = 86 32 60 51 32 90 78 71 89 78 79 33 b = 86 32 60 51 32 90 78 71 89 78 79 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))

a = 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 b = 71 117 114 32 b = 71 117 114 32 100 104 118 112 120 32 b = 71 117 114 32 100 104 118 112 120 32 115 98 107 32 b = 71 117 114 32 100 104 118 112 120 32 115 98 107 32 102 103 104 122 111 121 114 113 32 b = 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 b = 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 32 117 114 32 b = 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 42 117 114 32 112 98 97 115 104 102 118 97 116 32 b = 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 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))

a = 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 b = 70 97 110 99 114 32 b = 70 97 110 99 114 32 120 118 121 121 102 32 b = 70 97 110 99 114 32 120 118 121 121 102 32 81 104 122 111 121 114 113 98 101 114 32 b = 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 b = 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 31 114 32 b = 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 32 114 32 54 b = 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 33 114 32 54 48 b = 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 34 114 32 54 48 54 b = 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 35 114 32 54 48 54 46 b = 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 36 114 32 54 48 54 46 32 b = 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 41 114 32 54 48 54 46 32 78 121 102 98 44 b = 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 42 114 32 54 48 54 46 32 78 121 102 98 44 32 b = 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 48 114 32 54 48 54 46 32 78 121 102 98 44 32 103 117 114 101 114 32 b = 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 51 114 32 54 48 54 46 32 78 121 102 98 44 32 103 117 114 101 114 32 118 102 32 b = 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 54 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 b = 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 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.'