Cody

Problem 78. Implement a ROT13 cipher

Solution 2050421

Submitted on 8 Dec 2019 by Asif Newaz
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 a = 86 32 121 98 105 114 32 90 78 71 89 78 79 c = 'V ybir ZNGYNO' 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 a = 86 32 60 51 32 90 78 71 89 78 79 33 33 c = 'V <3 ZNGYNO!!' 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 30 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 104 Columns 31 through 55 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 a = Columns 1 through 30 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 117 Columns 31 through 55 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 c = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf.' 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 30 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 101 Columns 31 through 60 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 97 46 a = Columns 1 through 30 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 114 Columns 31 through 60 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 110 46 c = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.'